String.prototype.trim = function () {
    return this.replace(/^\s+|\s+$/g, "")
};
String.prototype.toInt = function () {
    return parseInt(this, 10)
};
String.prototype.camelCase = function () {
    return this.replace(/-\D/g, function (A) {
        return A.charAt(1).toUpperCase()
    })
};
String.prototype.toObject = function () {
    var C = window;
    var D = this.split(".");
    try {
        for (var B = 0; B < D.length; B++) {
            C = C[D[B]]
        }
    } catch (A) {
        C = null
    }
    return C
};
String.prototype.htmlEncode = function () {
    var A = this;
    A = A.replace(/&/g, "&amp;");
    A = A.replace(/</g, "&lt;");
    A = A.replace(/>/g, "&gt;");
    A = A.replace(/"/g, "&quot;");
    return A
};
String.prototype.htmlDecode = function () {
    var A = this;
    A = A.replace(/&amp;/g, "&");
    A = A.replace(/&lt;/g, "<");
    A = A.replace(/&gt;/g, ">");
    A = A.replace(/&quot;/g, '"');
    return A
};
String.HTML_TRANSLATION_TABLE = {
    "quot": 34,
    "amp": 38,
    "lt": 60,
    "gt": 62,
    "nbsp": 160,
    "iexcl": 161,
    "cent": 162,
    "pound": 163,
    "curren": 164,
    "yen": 165,
    "brvbar": 166,
    "sect": 167,
    "uml": 168,
    "copy": 169,
    "ordf": 170,
    "laquo": 171,
    "not": 172,
    "shy": 173,
    "reg": 174,
    "macr": 175,
    "deg": 176,
    "plusmn": 177,
    "sup2": 178,
    "sup3": 179,
    "acute": 180,
    "micro": 181,
    "para": 182,
    "middot": 183,
    "cedil": 184,
    "sup1": 185,
    "ordm": 186,
    "raquo": 187,
    "frac14": 188,
    "frac12": 189,
    "frac34": 190,
    "iquest": 191,
    "Agrave": 192,
    "Aacute": 193,
    "Acirc": 194,
    "Atilde": 195,
    "Auml": 196,
    "Aring": 197,
    "AElig": 198,
    "Ccedil": 199,
    "Egrave": 200,
    "Eacute": 201,
    "Ecirc": 202,
    "Euml": 203,
    "Igrave": 204,
    "Iacute": 205,
    "Icirc": 206,
    "Iuml": 207,
    "ETH": 208,
    "Ntilde": 209,
    "Ograve": 210,
    "Oacute": 211,
    "Ocirc": 212,
    "Otilde": 213,
    "Ouml": 214,
    "times": 215,
    "Oslash": 216,
    "Ugrave": 217,
    "Uacute": 218,
    "Ucirc": 219,
    "Uuml": 220,
    "Yacute": 221,
    "THORN": 222,
    "szlig": 223,
    "agrave": 224,
    "aacute": 225,
    "acirc": 226,
    "atilde": 227,
    "auml": 228,
    "aring": 229,
    "aelig": 230,
    "ccedil": 231,
    "egrave": 232,
    "eacute": 233,
    "ecirc": 234,
    "euml": 235,
    "igrave": 236,
    "iacute": 237,
    "icirc": 238,
    "iuml": 239,
    "eth": 240,
    "ntilde": 241,
    "ograve": 242,
    "oacute": 243,
    "ocirc": 244,
    "otilde": 245,
    "ouml": 246,
    "divide": 247,
    "oslash": 248,
    "ugrave": 249,
    "uacute": 250,
    "ucirc": 251,
    "uuml": 252,
    "yacute": 253,
    "thorn": 254,
    "yuml": 255
};
String.prototype.fullHTMLEncode = function () {
    var A = this;
    var B = /&(.*?);/gi;
    A = A.replace(B, function (F, D) {
        var C = D;
        var G = (typeof String.HTML_TRANSLATION_TABLE[D] !== undefined) ? String.HTML_TRANSLATION_TABLE[D] : undefined;
        if (typeof G === "number") {
            C = String.fromCharCode(G)
        } else {
            if (typeof G === "undefined") {
                if (D.substr(0, 1) === "#") {
                    var E = parseInt(D.substr(1), 10);
                    if (!isNaN(E)) {
                        C = String.fromCharCode(E)
                    }
                }
            }
        }
        return C
    });
    return A
};
Function.prototype.delay = function (B, E, A) {
    var C = this;
    var D = function () {
        return C.apply(E || C, A || [])
    };
    return setTimeout(D, B)
};
Function.prototype.periodical = function (B, E, A) {
    var C = this;
    var D = function () {
        return C.apply(E || C, A || [])
    };
    return setInterval(D, B)
};
Function.prototype.bind = function (B) {
    var A = this;
    return function () {
        return A.apply(B, arguments)
    }
};

function $clear(A) {
    clearTimeout(A);
    clearInterval(A);
    return null
}
var $each = function (D, C, E) {
    for (var B = 0, A = D.length; B < A; B++) {
        C.call(E || C, D[B], B)
    }
};

function in_array(E, D, C) {
    var B = "",
        A = !! C;
    if (A) {
        for (B in D) {
            if (!D.hasOwnProperty(B)) {
                continue
            }
            if (D[B] === E) {
                return true
            }
        }
    } else {
        for (B in D) {
            if (!D.hasOwnProperty(B)) {
                continue
            }
            if (D[B] == E) {
                return true
            }
        }
    }
    return false
}
function array_merge() {
    var C = Array.prototype.slice.call(arguments);
    var F = {},
        A, B = 0,
        E = 0;
    var G;
    for (E = 0, G = true; E < C.length; E++) {
        if (!(C[E] instanceof Array)) {
            G = false;
            break
        }
    }
    if (G) {
        return C
    }
    var D = 0;
    for (E = 0, D = 0; E < C.length; E++) {
        if (C[E] instanceof Array) {
            for (B = 0; B < C[E].length; B++) {
                F[D++] = C[E][B]
            }
        } else {
            for (A in C[E]) {
                if (this.is_int(A)) {
                    F[D++] = C[E][A]
                } else {
                    F[A] = C[E][A]
                }
            }
        }
    }
    return F
}
function array_merge_recursive(C, B) {
    var A = "";
    if ((C && (C instanceof Array)) && (B && (B instanceof Array))) {
        for (A in B) {
            C.push(B[A])
        }
    } else {
        if ((C && (C instanceof Object)) && (B && (B instanceof Object))) {
            for (A in B) {
                if (A in C) {
                    if (typeof C[A] == "object" && typeof B == "object") {
                        C[A] = this.array_merge(C[A], B[A])
                    } else {
                        C[A] = B[A]
                    }
                } else {
                    C[A] = B[A]
                }
            }
        }
    }
    return C
}
function is_int(A) {
    if (typeof A !== "number") {
        return false
    }
    return !(A % 1)
}
var Element = function (C, B) {
    C = document.createElement(C);
    for (var A in this) {
        C[A] = this[A]
    }
    C.extend = true;
    C.attr(B || {});
    return C
};
var $ = function (B) {
    if (!B.nodeType) {
        B = document.getElementById(B);
        if (!B) {
            return false
        }
    }
    if (!B.extend || (B.extend && !B.hasClass)) {
        for (var A in Element.prototype) {
            B[A] = Element.prototype[A]
        }
        B.extend = true
    }
    return B
};
var $id = function (A) {
    if (!A.nodeType) {
        A = document.getElementById(A)
    }
    return A
};
Element.prototype = {
    toArray: function (A) {
        return Array.prototype.slice.call(A)
    }
};
Element.extend = function (B) {
    for (var A in B) {
        if (!B.hasOwnProperty(A)) {
            continue
        }
        Element.prototype[A] = B[A]
    }
};
Element.extend({
    getHTML: function () {
        return this.innerHTML
    }, setHTML: function (A) {
        this.innerHTML = A;
        return this
    }, inject: function (B, A) {
        B = $(B);
        switch (A) {
        case "top":
            var D = $(B).firstChild;
            if (D) {
                B.insertBefore(this, D)
            } else {
                B.appendChild(this)
            }
            break;
        case "before":
            if (B.parentNode) {
                B.parentNode.insertBefore(this, B)
            }
            break;
        case "after":
            if (B.parentNode) {
                var C = B.nextSibling;
                if (C) {
                    B.parentNode.insertBefore(this, C)
                } else {
                    B.parentNode.appendChild(this)
                }
            }
            break;
        default:
            B.appendChild(this)
        }
        return this
    }, adopt: function () {
        var B;
        for (var A = 0; A < arguments.length; A++) {
            B = $(arguments[A]);
            if (B) {
                this.appendChild(B)
            }
        }
        return this
    }, remove: function () {
        return (this.parentNode) ? this.parentNode.removeChild(this) : this
    }
});
Element.extend({
    getElement: function (A) {
        A = this.getElementsByTagName(A);
        return (A.length > 0) ? $(A[0]) : undefined
    }, getElements: function (A) {
        var D = [];
        var B = this.getElementsByTagName(A);
        for (var C = 0; C < B.length; C++) {
            D.push($(B[C]))
        }
        return D
    }, getElementsByPartialId: function (L, H) {
        TConsole.info("getElementsByPartialId ( " + L + " )");
        if (typeof H === "undefined") {
            H = true
        }
        if (!H) {
            H = false
        }
        var E = [],
            B = [],
            J = false,
            I = 0;
        if (this.querySelectorAll) {
            try {
                B = this.querySelectorAll("[id*='" + L + "']");
                J = true
            } catch (G) {}
        }
        if (!J) {
            var D = "\\sid\\s*=\\s*[\"']?(\\S*" + L + "\\S*?)[\"']?[\\s>]";
            var K = new RegExp(D, "mg");
            var C = "";
            var A = undefined;
            if (this.nodeType === 9) {
                C = this.body.innerHTML
            } else {
                if (this.nodeType === 1) {
                    C = this.innerHTML
                } else {
                    return E
                }
            }
            K.lastIndex = 0;
            while (A = K.exec(C)) {
                B.push(A[1])
            }
        }
        I = B.length;
        for (var F = 0; F < I; F++) {
            E.push(((H) ? $(B[F]) : B[F]))
        }
        delete B;
        return E
    }, getClass: function (M, Q) {
        var H = [];
        var E;
        if (document.getElementsByClassName) {
            E = M.split(" ");
            var P;
            for (var J = 0; J < E.length; J++) {
                P = this.getElementsByClassName(E[J]);
                for (var I = 0; I < P.length; I++) {
                    H.push($(P[I]))
                }
            }
            return H
        } else {
            E = M.split(" ");
            var O = [],
                A = this.getElementsByTagName(Q || "*"),
                L, K;
            for (var F = 0, B = E.length; F < B; F += 1) {
                O.push(new RegExp("(^|\\s)" + E[F] + "(\\s|$)"))
            }
            for (var D = 0, N = A.length; D < N; D += 1) {
                L = A[D];
                K = false;
                for (var C = 0, G = O.length; C < G; C += 1) {
                    K = O[C].test(L.className);
                    if (K) {
                        break
                    }
                }
                if (K) {
                    H.push($(L))
                }
            }
        }
        return H
    }, getParent: function () {
        return $(this.parentNode)
    }, getFirst: function () {
        var B = this.firstChild,
            A = false;
        while (B) {
            if (B.nodeType == 1) {
                A = $(B);
                break
            }
            B = B.nextSibling
        }
        return A
    }, getLast: function () {
        var B = this.lastChild,
            A = false;
        while (B) {
            if (B.nodeType == 1) {
                A = $(B);
                break
            }
            B = B.previousSibling
        }
        return A
    }, getNext: function () {
        var B = this.nextSibling,
            A = false;
        while (B) {
            if (B.nodeType == 1) {
                A = $(B);
                break
            }
            B = B.nextSibling
        }
        return A
    }, getPrevious: function () {
        var B = this.previousSibling,
            A = false;
        while (B) {
            if (B.nodeType == 1) {
                A = $(B);
                break
            }
            B = B.previousSibling
        }
        return A
    }, getNextWithTagName: function (C) {
        C = C.toLowerCase();
        var B = this.nextSibling,
            A = false;
        while (B) {
            if (B.nodeType == 1 && B.tagName.toLowerCase() === C) {
                A = $(B);
                break
            }
            B = B.nextSibling
        }
        return A
    }, getPreviousWithTagName: function (C) {
        C = C.toLowerCase();
        var B = this.previousSibling,
            A = false;
        while (B) {
            if (B.nodeType == 1 && B.tagName.toLowerCase() === C) {
                A = $(B);
                break
            }
            B = B.previousSibling
        }
        return A
    }, getChildren: function () {
        var C = [];
        for (var B = 0, A = this.childNodes.length; B < A; B++) {
            if (this.childNodes[B].nodeType == 1) {
                C.push($(this.childNodes[B]))
            }
        }
        return C
    }, deleteAllChildren: function () {
        if (Browser.ie) {
            while (this.firstChild) {
                this.removeChild(this.firstChild)
            }
        } else {
            this.innerHTML = ""
        }
    }, getChildById: function (E) {
        var D = null;
        var A = this.getChildren();
        while (A.length > 0) {
            var C = A.pop();
            if (C.id && C.id === E) {
                D = C;
                break
            }
            var B = C.getFirst();
            while (B) {
                A.push(B);
                B = B.getNext()
            }
        }
        return D
    }
});
Element.extend({
    attr: function (A, C) {
        if (typeof A == "object") {
            for (var B in A) {
                if (!A.hasOwnProperty(B)) {
                    continue
                }
                this.attr(B, A[B])
            }
        } else {
            if (C) {
                this.setAttribute(A, C)
            } else {
                return this.getAttribute(A)
            }
        }
        return this
    }, getAttr: function (A) {
        return this.getAttribute(A)
    }, setAttr: function (A, B) {
        this.setAttribute(A, B);
        return this
    }, hasAttr: function (A) {
        if (this.hasAttribute) {
            return this.hasAttribute(A)
        } else {
            for (var B in this) {
                if (B == A && typeof B !== "function") {
                    return true
                }
            }
            return false
        }
    }, getTag: function () {
        return this.tagName.toLowerCase()
    }, setClass: function (A) {
        this.className = A;
        return this
    }, addClass: function (A) {
        if (!this.hasClass(A)) {
            this.className = (this.className + " " + A).trim()
        }
        return this
    }, removeClass: function (A) {
        this.className = this.className.replace(new RegExp("(^|\\s)" + A + "(?:\\s|$)"), "$1").trim();
        return this
    }, resetClass: function (A) {
        this.className = "";
        return this
    }, hasClass: function (A) {
        return (new RegExp("(?:^|\\s+)" + A + "(?:\\s+|$)")).test(this.className)
    }, toggleClass: function (A) {
        if (this.hasClass(A)) {
            this.removeClass(A)
        } else {
            this.addClass(A)
        }
    }, show: function () {
        return this.removeClass("hide")
    }, hide: function () {
        return this.addClass("hide")
    }, isHidden: function () {
        return this.hasClass("hide")
    }, toggle: function () {
        if (this.hasClass("hide")) {
            this.show()
        } else {
            this.hide()
        }
    }, disable: function () {
        this.setAttr("disabled", "disabled");
        if (!this.hasClass("disabled")) {
            this.addClass("disabled")
        }
    }, enable: function () {
        if (this.hasAttr("disabled")) {
            this.removeAttribute("disabled")
        }
        if (this.hasClass("disabled")) {
            this.removeClass("disabled")
        }
    }
});
Element.extend({
    setStyle: function (C, B) {
        if (C == "opacity") {
            B = parseFloat(B);
            if (!this.currentStyle || !this.currentStyle.hasLayout) {
                this.style.zoom = 1
            }
            if (Browser.ie) {
                this.style.filter = (B == 1) ? "" : "alpha(opacity=" + B * 100 + ")"
            }
            this.opacity = B;
            this.style.opacity = B
        } else {
            try {
                this.style[C.camelCase()] = B
            } catch (A) {}
        }
        return this
    }, setStyles: function (A) {
        for (var B in A) {
            if (!A.hasOwnProperty(B)) {
                continue
            }
            this.setStyle(B, A[B])
        }
        return this
    }, getStyle: function (A) {
        if (A == "opacity") {
            return this.opacity
        }
        return this.style[A.camelCase()]
    }
});
Element.extend({
    getSize: function () {
        return {
            "x": this.offsetWidth,
            "y": this.offsetHeight
        }
    }, findPosition: function () {
        var A = 0;
        var C = 0;
        var B = this;
        if (B.offsetParent) {
            do {
                A += B.offsetLeft;
                C += B.offsetTop
            } while (B = B.offsetParent);
            return {
                "x": A,
                "y": C
            }
        } else {
            return {
                "x": B.offsetLeft,
                "y": B.offsetTop
            }
        }
    }, visible: function () {
        return this.offsetWidth > 0 || this.offsetHeight > 0
    }
});
Element.extend({
    addEvent: function (B, A, C) {
        if (C) {
            this["on" + B] = A
        } else {
            if (this.addEventListener) {
                this.addEventListener(B, A, false)
            } else {
                this.attachEvent("on" + B, A)
            }
        }
        return this
    }, removeEvent: function (B, A, C) {
        if (C === true) {
            if (Browser.ie) {
                this["on" + B] = function () {}
            } else {
                this["on" + B] = false
            }
        } else {
            if (this.removeEventListener) {
                this.removeEventListener(B, A, false)
            } else {
                this.detachEvent("on" + B, A)
            }
        }
        return this
    }, addEvents: function (B) {
        for (var A in B) {
            if (!B.hasOwnProperty(A)) {
                continue
            }
            this.addEvent(A, B[A])
        }
        return this
    }
});

function get_mouse_position(A) {
    var B = {};
    B.x = A.pageX || A.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
    B.y = A.pageY || A.clientY + document.body.scrollTop + document.documentElement.scrollTop;
    return B
}
function stop_event_propagation(A) {
    if (typeof A.cancelBubble === "undefined") {
        var B = window.event;
        B.cancelBubble = true;
        if (B.stopPropagation) {
            B.stopPropagation()
        }
    }
}
window.addEvent = document.addEvent = Element.prototype.addEvent;
window.removeEvent = document.removeEvent = Element.prototype.removeEvent;
if (Browser.ie) {
    window.has_focus = function () {
        return document.hasFocus()
    }
} else {
    window._own_focus = true;
    window.on_windows_blur = function () {
        this._own_focus = false
    };
    window.on_windows_focus = function () {
        this._own_focus = true
    };
    window.has_focus = function () {
        return this._own_focus
    };
    window.onfocus = window.on_windows_focus;
    window.onblur = window.on_windows_blur
}
Element.extend({
    cropText: function (D, H, E) {
        var C = H || 18;
        var B = 5;
        var A = C * D;
        var F = this.getSize()["y"];
        if (F > A) {
            this.style.overflow = "hidden";
            this.style.height = A + "px";
            var G = this.getSize()["y"] + this.findPosition()["y"] + B;
            this.removeOutsideElement(G);
            this.addEllipsis(G, E);
            this.style.overflow = "";
            this.style.height = ""
        }
    }, removeOutsideElement: function (E) {
        var H = this.getChildren();
        var F = H.length;
        var G = null;
        var B = false;
        for (var A = 0; A < F; A++) {
            var D = H[A];
            var C = D.findPosition()["y"] + D.getSize()["y"];
            if (C > E + 3) {
                if (B) {
                    this.removeChild(D)
                } else {
                    B = true
                }
                G = D
            }
        }
        if (G !== null) {
            G.removeOutsideElement(E)
        }
        return G
    }, addEllipsis: function (B, C) {
        var L = false;
        var D = this.childNodes;
        var J = D.length;
        for (var G = D.length - 1; G >= 0 && !L; G--) {
            var E = D[G];
            if (E.nodeType === 1) {
                L = $(E).addEllipsis(B, C)
            } else {
                if (E.nodeType === 3) {
                    var M = E.nodeValue.replace(/\n/g, "");
                    if (M.search(/^[ \t]*$/) === -1) {
                        var I = this;
                        if (typeof C !== "undefined") {
                            var H = E.nextSibling;
                            if (H) {
                                if (E.parentNode.nodeName.toLowerCase() == "a") {
                                    var K = E.parentNode.nextSibling;
                                    if (K) {
                                        E.parentNode.parentNode.insertBefore(C, K)
                                    } else {
                                        E.parentNode.parentNode.appendChild(C)
                                    }
                                    I = E.parentNode.parentNode
                                } else {
                                    E.parentNode.insertBefore(C, H)
                                }
                            } else {
                                if (E.parentNode.nodeName.toLowerCase() == "a") {
                                    E.parentNode.parentNode.appendChild(C);
                                    I = E.parentNode.parentNode
                                } else {
                                    E.parentNode.appendChild(C)
                                }
                            }
                        }
                        var F = false;
                        var A = I.findPosition()["y"];
                        E.nodeValue = M = M.replace(/[ \t]*(?:<\/?br\/?>)?(?:\.\.\.)?$/, "...");
                        while ((I.getSize()["y"] + A) > B && !F) {
                            if (M !== "...") {
                                E.nodeValue = M = M.replace(/.[ \t]*(?:<\/?br\/?>)?(?:\.\.\.)?$/, "...")
                            } else {
                                F = true;
                                if (typeof C !== "undefined") {
                                    if (this.nodeName.toLowerCase() == "a") {
                                        this.parentNode.removeChild(C)
                                    } else {
                                        this.removeChild(C)
                                    }
                                }
                                E.parentNode.removeChild(E)
                            }
                        }
                        if (!F) {
                            L = true
                        }
                    }
                }
            }
        }
        if (!L) {
            this.parentNode.removeChild(this)
        }
        return L
    }
});

function get_key_code(B) {
    var A = undefined;
    if (window.event) {
        A = (B && B.keyCode) ? B.keyCode : window.event.keyCode
    } else {
        if (B.which) {
            A = B.which
        }
    }
    return A
}
var KeyCode = {
    is_text_character: function (A) {
        return !(A >= 33 && A <= 40) && !(A >= 16 && A <= 18) && A != 224 && A != 8 && A != 46 && A != 9 && A != 12 && A != 116
    }, is_holding_meta_key: function (A) {
        return (A.ctrlKey || A.metaKey)
    }, is_holding_shift_key: function (A) {
        return A.shiftKey
    }, is_enter_key: function (B) {
        var A = get_key_code(B);
        return A === 13
    }, is_escape_key: function (B) {
        var A = get_key_code(B);
        return A === 27
    }
};
var ModalWindow = {
    open: function (B) {
        var A;
        if (Browser.ie7 || Browser.ie8) {
            A = this.openDialog(B)
        } else {
            A = this.openModal(B)
        }
        return A
    }, openModal: function (C) {
        var E = [];
        if (typeof C !== "object" || C === null) {
            C = {}
        }
        var B = C.url;
        if (typeof B !== "string" || B.length < 1) {
            throw "ModalWindow: Missing URL"
        }
        var A;
        var D;
        if (typeof C.size === "object" && C.size !== null) {
            if (typeof C.size.height !== "undefined") {
                E.push("dialogHeight:" + parseInt(C.size.height) + "px")
            }
            if (typeof C.size.width !== "undefined") {
                E.push("dialogWidth:" + parseInt(C.size.width) + "px")
            }
        }
        if (typeof C.center === "boolean") {
            E.push("center:" + (C.center ? "yes" : "no"))
        }
        return window.showModalDialog(C.url, C.data, E.join(";"))
    }, openDialog: function (D) {
        var G = [];
        if (typeof D !== "object" || D === null) {
            D = {}
        }
        var C = D.url;
        if (typeof C !== "string" || C.length < 1) {
            throw "ModalWindow: Missing URL"
        }
        G.push("menubar=no");
        G.push("toolbar=no");
        var B;
        var F;
        if (typeof D.size === "object" && D.size !== null) {
            if (typeof D.size.height !== "undefined") {
                var A = parseInt(D.size.height);
                G.push("height=" + A);
                F = Math.round((window.screen.height - A) / 2)
            }
            if (typeof D.size.width !== "undefined") {
                var E = parseInt(D.size.width);
                G.push("width=" + E);
                B = Math.round((window.screen.width - E) / 2)
            }
        }
        if (typeof D.center === "boolean") {
            if (typeof B !== "undefined") {
                G.push("left=" + B)
            }
            if (typeof F !== "undefined") {
                G.push("top=" + F)
            }
        }
        return window.open(D.url, null, G.join(","))
    }
};

function binary_contains(D, C) {
    if (!D || D.length === 0) {
        return false
    }
    var B = 0;
    var A = D.length - 1;
    var E;
    while (B <= A) {
        E = B + parseInt((A - B) / 2, 10);
        if (D[E] > C) {
            A = E - 1
        } else {
            if (D[E] < C) {
                B = E + 1
            } else {
                return true
            }
        }
    }
    return false
}
function integer_sort_number(B, A) {
    return parseInt(B, 10) - parseInt(A, 10)
}
function custom_random(B, A) {
    var D = A - B;
    var C = Math.floor(Math.random() * D);
    return parseInt(B) + C
}
function get_javascript(C) {
    var A = document.createElement("script");
    A.setAttribute("type", "text/javascript");
    A.setAttribute("src", C);
    var B = document.getElementsByTagName("head")[0];
    B.appendChild(A)
}
function int_to_hex(A) {
    return parseInt(A, 10).toString(16)
}
function hex_to_int(A) {
    return parseInt(A, 16)
}
function int_to_hexatrigesimal(A) {
    return parseInt(A, 10).toString(36)
}
window.itohexatrigesimal = int_to_hexatrigesimal;

function hexatrigesimal_to_int(A) {
    return parseInt(A, 36)
}
window.hexatrigesimaltoi = hexatrigesimal_to_int;

function htmlspecialchars(A) {
    if (typeof A === "string") {
        return A.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;")
    } else {
        return A
    }
}
if (document.ELEMENT_NODE == null) {
    document.ELEMENT_NODE = 1;
    document.ATTRIBUTE_NODE = 2;
    document.TEXT_NODE = 3;
    document.CDATA_SECTION_NODE = 4;
    document.ENTITY_REFERENCE_NODE = 5;
    document.ENTITY_NODE = 6;
    document.PROCESSING_INSTRUCTION_NODE = 7;
    document.COMMENT_NODE = 8;
    document.DOCUMENT_NODE = 9;
    document.DOCUMENT_TYPE_NODE = 10;
    document.DOCUMENT_FRAGMENT_NODE = 11;
    document.NOTATION_NODE = 12
}
load.trace("js/web2-Zero/1_utils.js");
var hexcase = 0;
var b64pad = "";

function hex_md5(A) {
    return rstr2hex(rstr_md5(str2rstr_utf8(A)))
}
function b64_md5(A) {
    return rstr2b64(rstr_md5(str2rstr_utf8(A)))
}
function any_md5(A, B) {
    return rstr2any(rstr_md5(str2rstr_utf8(A)), B)
}
function hex_hmac_md5(A, B) {
    return rstr2hex(rstr_hmac_md5(str2rstr_utf8(A), str2rstr_utf8(B)))
}
function b64_hmac_md5(A, B) {
    return rstr2b64(rstr_hmac_md5(str2rstr_utf8(A), str2rstr_utf8(B)))
}
function any_hmac_md5(A, C, B) {
    return rstr2any(rstr_hmac_md5(str2rstr_utf8(A), str2rstr_utf8(C)), B)
}
function md5_vm_test() {
    return hex_md5("abc").toLowerCase() == "900150983cd24fb0d6963f7d28e17f72"
}
function rstr_md5(A) {
    return binl2rstr(binl_md5(rstr2binl(A), A.length * 8))
}
function rstr_hmac_md5(C, F) {
    var E = rstr2binl(C);
    if (E.length > 16) {
        E = binl_md5(E, C.length * 8)
    }
    var A = Array(16),
        D = Array(16);
    for (var B = 0; B < 16; B++) {
        A[B] = E[B] ^ 909522486;
        D[B] = E[B] ^ 1549556828
    }
    var G = binl_md5(A.concat(rstr2binl(F)), 512 + F.length * 8);
    return binl2rstr(binl_md5(D.concat(G), 512 + 128))
}
function rstr2hex(C) {
    try {
        hexcase
    } catch (F) {
        hexcase = 0
    }
    var E = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
    var B = "";
    var A;
    for (var D = 0; D < C.length; D++) {
        A = C.charCodeAt(D);
        B += E.charAt((A >>> 4) & 15) + E.charAt(A & 15)
    }
    return B
}
function rstr2b64(C) {
    try {
        b64pad
    } catch (G) {
        b64pad = ""
    }
    var F = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    var B = "";
    var A = C.length;
    for (var E = 0; E < A; E += 3) {
        var H = (C.charCodeAt(E) << 16) | (E + 1 < A ? C.charCodeAt(E + 1) << 8 : 0) | (E + 2 < A ? C.charCodeAt(E + 2) : 0);
        for (var D = 0; D < 4; D++) {
            if (E * 8 + D * 6 > C.length * 8) {
                B += b64pad
            } else {
                B += F.charAt((H >>> 6 * (3 - D)) & 63)
            }
        }
    }
    return B
}
function rstr2any(K, C) {
    var B = C.length;
    var J, F, A, L, E;
    var I = Array(Math.ceil(K.length / 2));
    for (J = 0; J < I.length; J++) {
        I[J] = (K.charCodeAt(J * 2) << 8) | K.charCodeAt(J * 2 + 1)
    }
    var H = Math.ceil(K.length * 8 / (Math.log(C.length) / Math.log(2)));
    var G = Array(H);
    for (F = 0; F < H; F++) {
        E = Array();
        L = 0;
        for (J = 0; J < I.length; J++) {
            L = (L << 16) + I[J];
            A = Math.floor(L / B);
            L -= A * B;
            if (E.length > 0 || A > 0) {
                E[E.length] = A
            }
        }
        G[F] = L;
        I = E
    }
    var D = "";
    for (J = G.length - 1; J >= 0; J--) {
        D += C.charAt(G[J])
    }
    return D
}
function str2rstr_utf8(C) {
    var B = "";
    var D = -1;
    var A, E;
    while (++D < C.length) {
        A = C.charCodeAt(D);
        E = D + 1 < C.length ? C.charCodeAt(D + 1) : 0;
        if (55296 <= A && A <= 56319 && 56320 <= E && E <= 57343) {
            A = 65536 + ((A & 1023) << 10) + (E & 1023);
            D++
        }
        if (A <= 127) {
            B += String.fromCharCode(A)
        } else {
            if (A <= 2047) {
                B += String.fromCharCode(192 | ((A >>> 6) & 31), 128 | (A & 63))
            } else {
                if (A <= 65535) {
                    B += String.fromCharCode(224 | ((A >>> 12) & 15), 128 | ((A >>> 6) & 63), 128 | (A & 63))
                } else {
                    if (A <= 2097151) {
                        B += String.fromCharCode(240 | ((A >>> 18) & 7), 128 | ((A >>> 12) & 63), 128 | ((A >>> 6) & 63), 128 | (A & 63))
                    }
                }
            }
        }
    }
    return B
}
function str2rstr_utf16le(B) {
    var A = "";
    for (var C = 0; C < B.length; C++) {
        A += String.fromCharCode(B.charCodeAt(C) & 255, (B.charCodeAt(C) >>> 8) & 255)
    }
    return A
}
function str2rstr_utf16be(B) {
    var A = "";
    for (var C = 0; C < B.length; C++) {
        A += String.fromCharCode((B.charCodeAt(C) >>> 8) & 255, B.charCodeAt(C) & 255)
    }
    return A
}
function rstr2binl(B) {
    var A = Array(B.length >> 2);
    for (var C = 0; C < A.length; C++) {
        A[C] = 0
    }
    for (var C = 0; C < B.length * 8; C += 8) {
        A[C >> 5] |= (B.charCodeAt(C / 8) & 255) << (C % 32)
    }
    return A
}
function binl2rstr(B) {
    var A = "";
    for (var C = 0; C < B.length * 32; C += 8) {
        A += String.fromCharCode((B[C >> 5] >>> (C % 32)) & 255)
    }
    return A
}
function binl_md5(K, F) {
    K[F >> 5] |= 128 << ((F) % 32);
    K[(((F + 64) >>> 9) << 4) + 14] = F;
    var J = 1732584193;
    var I = -271733879;
    var H = -1732584194;
    var G = 271733878;
    for (var C = 0; C < K.length; C += 16) {
        var E = J;
        var D = I;
        var B = H;
        var A = G;
        J = md5_ff(J, I, H, G, K[C + 0], 7, -680876936);
        G = md5_ff(G, J, I, H, K[C + 1], 12, -389564586);
        H = md5_ff(H, G, J, I, K[C + 2], 17, 606105819);
        I = md5_ff(I, H, G, J, K[C + 3], 22, -1044525330);
        J = md5_ff(J, I, H, G, K[C + 4], 7, -176418897);
        G = md5_ff(G, J, I, H, K[C + 5], 12, 1200080426);
        H = md5_ff(H, G, J, I, K[C + 6], 17, -1473231341);
        I = md5_ff(I, H, G, J, K[C + 7], 22, -45705983);
        J = md5_ff(J, I, H, G, K[C + 8], 7, 1770035416);
        G = md5_ff(G, J, I, H, K[C + 9], 12, -1958414417);
        H = md5_ff(H, G, J, I, K[C + 10], 17, -42063);
        I = md5_ff(I, H, G, J, K[C + 11], 22, -1990404162);
        J = md5_ff(J, I, H, G, K[C + 12], 7, 1804603682);
        G = md5_ff(G, J, I, H, K[C + 13], 12, -40341101);
        H = md5_ff(H, G, J, I, K[C + 14], 17, -1502002290);
        I = md5_ff(I, H, G, J, K[C + 15], 22, 1236535329);
        J = md5_gg(J, I, H, G, K[C + 1], 5, -165796510);
        G = md5_gg(G, J, I, H, K[C + 6], 9, -1069501632);
        H = md5_gg(H, G, J, I, K[C + 11], 14, 643717713);
        I = md5_gg(I, H, G, J, K[C + 0], 20, -373897302);
        J = md5_gg(J, I, H, G, K[C + 5], 5, -701558691);
        G = md5_gg(G, J, I, H, K[C + 10], 9, 38016083);
        H = md5_gg(H, G, J, I, K[C + 15], 14, -660478335);
        I = md5_gg(I, H, G, J, K[C + 4], 20, -405537848);
        J = md5_gg(J, I, H, G, K[C + 9], 5, 568446438);
        G = md5_gg(G, J, I, H, K[C + 14], 9, -1019803690);
        H = md5_gg(H, G, J, I, K[C + 3], 14, -187363961);
        I = md5_gg(I, H, G, J, K[C + 8], 20, 1163531501);
        J = md5_gg(J, I, H, G, K[C + 13], 5, -1444681467);
        G = md5_gg(G, J, I, H, K[C + 2], 9, -51403784);
        H = md5_gg(H, G, J, I, K[C + 7], 14, 1735328473);
        I = md5_gg(I, H, G, J, K[C + 12], 20, -1926607734);
        J = md5_hh(J, I, H, G, K[C + 5], 4, -378558);
        G = md5_hh(G, J, I, H, K[C + 8], 11, -2022574463);
        H = md5_hh(H, G, J, I, K[C + 11], 16, 1839030562);
        I = md5_hh(I, H, G, J, K[C + 14], 23, -35309556);
        J = md5_hh(J, I, H, G, K[C + 1], 4, -1530992060);
        G = md5_hh(G, J, I, H, K[C + 4], 11, 1272893353);
        H = md5_hh(H, G, J, I, K[C + 7], 16, -155497632);
        I = md5_hh(I, H, G, J, K[C + 10], 23, -1094730640);
        J = md5_hh(J, I, H, G, K[C + 13], 4, 681279174);
        G = md5_hh(G, J, I, H, K[C + 0], 11, -358537222);
        H = md5_hh(H, G, J, I, K[C + 3], 16, -722521979);
        I = md5_hh(I, H, G, J, K[C + 6], 23, 76029189);
        J = md5_hh(J, I, H, G, K[C + 9], 4, -640364487);
        G = md5_hh(G, J, I, H, K[C + 12], 11, -421815835);
        H = md5_hh(H, G, J, I, K[C + 15], 16, 530742520);
        I = md5_hh(I, H, G, J, K[C + 2], 23, -995338651);
        J = md5_ii(J, I, H, G, K[C + 0], 6, -198630844);
        G = md5_ii(G, J, I, H, K[C + 7], 10, 1126891415);
        H = md5_ii(H, G, J, I, K[C + 14], 15, -1416354905);
        I = md5_ii(I, H, G, J, K[C + 5], 21, -57434055);
        J = md5_ii(J, I, H, G, K[C + 12], 6, 1700485571);
        G = md5_ii(G, J, I, H, K[C + 3], 10, -1894986606);
        H = md5_ii(H, G, J, I, K[C + 10], 15, -1051523);
        I = md5_ii(I, H, G, J, K[C + 1], 21, -2054922799);
        J = md5_ii(J, I, H, G, K[C + 8], 6, 1873313359);
        G = md5_ii(G, J, I, H, K[C + 15], 10, -30611744);
        H = md5_ii(H, G, J, I, K[C + 6], 15, -1560198380);
        I = md5_ii(I, H, G, J, K[C + 13], 21, 1309151649);
        J = md5_ii(J, I, H, G, K[C + 4], 6, -145523070);
        G = md5_ii(G, J, I, H, K[C + 11], 10, -1120210379);
        H = md5_ii(H, G, J, I, K[C + 2], 15, 718787259);
        I = md5_ii(I, H, G, J, K[C + 9], 21, -343485551);
        J = safe_add(J, E);
        I = safe_add(I, D);
        H = safe_add(H, B);
        G = safe_add(G, A)
    }
    return Array(J, I, H, G)
}
function md5_cmn(F, C, B, A, E, D) {
    return safe_add(bit_rol(safe_add(safe_add(C, F), safe_add(A, D)), E), B)
}
function md5_ff(C, B, G, F, A, E, D) {
    return md5_cmn((B & G) | ((~B) & F), C, B, A, E, D)
}
function md5_gg(C, B, G, F, A, E, D) {
    return md5_cmn((B & F) | (G & (~F)), C, B, A, E, D)
}
function md5_hh(C, B, G, F, A, E, D) {
    return md5_cmn(B ^ G ^ F, C, B, A, E, D)
}
function md5_ii(C, B, G, F, A, E, D) {
    return md5_cmn(G ^ (B | (~F)), C, B, A, E, D)
}
function safe_add(A, D) {
    var C = (A & 65535) + (D & 65535);
    var B = (A >> 16) + (D >> 16) + (C >> 16);
    return (B << 16) | (C & 65535)
}
function bit_rol(A, B) {
    return (A << B) | (A >>> (32 - B))
}
load.trace("js/web2-Zero/1_hash.js");
var Base = {
    all_loaded_trigger: function () {
        if ($("canvas")) {
            var A = $("canvas").getFirst().attr("id");
            if (A !== undefined && CanvasTrigger[A]) {
                CanvasTrigger[A]()
            }
        }
    }, extend: function (B) {
        B = B || {};
        for (var A in B) {
            if (!B.hasOwnProperty(A)) {
                continue
            }
            this[A] = B[A]
        }
    }, update: function (A) {}
};
var CanvasTrigger = {};
CanvasTrigger.extend = Base.extend;
var CanvasExitsTrigger = {};
CanvasExitsTrigger.extend = Base.extend;
var HomeTrigger = {};
HomeTrigger.extend = Base.extend;
var BlocksTrigger = {};
BlocksTrigger.extend = Base.extend;
var AlbumsTrigger = {};
AlbumsTrigger.extend = Base.extend;
var AlbumsshowcaseTrigger = {};
AlbumsshowcaseTrigger.extend = Base.extend;
var PeopleTrigger = {};
PeopleTrigger.extend = Base.extend;
var PhotoEditTrigger = {};
PhotoEditTrigger.extend = Base.extend;
var SettingsTrigger = {};
SettingsTrigger.extend = Base.extend;
var VideosTrigger = {};
VideosTrigger.extend = Base.extend;
var AdminBarTrigger = {};
AdminBarTrigger.extend = Base.extend;
var StatusTrigger = {};
StatusTrigger.extend = Base.extend;
var ContentSuggestionsTrigger = {};
ContentSuggestionsTrigger.extend = Base.extend;
var LightBoxTrigger = {};
LightBoxTrigger.extend = Base.extend;
var TemplatesTrigger = {};
TemplatesTrigger.extend = Base.extend;
var WidgetsTrigger = {};
WidgetsTrigger.extend = Base.extend;
load.trace("js/web2-Zero/1_base.js", SELECTOR_PRIORITY_TRIGGERS + 1, Base.all_loaded_trigger);
var UI = {};
UI.actions = function (A) {
    var B = function (E) {
        var D = E.getParent();
        if (D.getTag() == "div") {
            return D
        } else {
            return B(D)
        }
    };
    var C = $(A || "canvas");
    if (C) {
        C = C.getClass("action actions", "div", true);
        $each(C, function (D) {
            if (!D.hasClass("fix")) {
                var E;
                if (D.hasClass("actions")) {
                    $each(D.getChildren(true), function (F) {
                        if (F.getTag() == "span" || F.hasClass("fix")) {
                            return
                        }
                        F.setStyle("display", "none")
                    });
                    E = B(D);
                    E.addEvent("mouseover", function (F) {
                        $each(D.getChildren(true), function (G) {
                            if (G.getTag() == "span") {
                                return
                            }
                            G.setStyle("display", "inline")
                        })
                    });
                    E.addEvent("mouseout", function (F) {
                        $each(D.getChildren(true), function (G) {
                            if (G.getTag() == "span" || G.hasClass("fix")) {
                                return
                            }
                            G.setStyle("display", "none")
                        })
                    })
                } else {
                    D.setStyle("display", "none");
                    E = B(D);
                    E.addEvent("mouseover", function (F) {
                        D.setStyle("display", "inline")
                    });
                    E.addEvent("mouseout", function (F) {
                        D.setStyle("display", "none")
                    })
                }
            }
        })
    }
};
UI.tab = function (B) {
    UI.normalHeader();
    var A = $("sections").getElements("a");
    $each(A, function (C) {
        if (C.hasClass("active")) {
            C.removeClass("active")
        }
    });
    if ($("tab_settings").hasClass("active")) {
        $("tab_settings").removeClass("active")
    }
    if (B) {
        $(B).addClass("active")
    }
};
UI.corporateTab = function (B) {
    UI.corporateHeader();
    var A = $("corporate_sections").getElements("a");
    $each(A, function (C) {
        if (C.hasClass("active")) {
            C.removeClass("active")
        }
    });
    if (B) {
        $(B).addClass("active")
    }
};
UI.corporateHeader = function () {
    if ($("corporate_container").isHidden()) {
        $("header").hide();
        $("corporate_container").show()
    }
};
UI.normalHeader = function () {
    if ($("header").isHidden()) {
        $("header").show();
        $("corporate_container").hide()
    }
};
UI.load = function (B) {
    var C = $("loading");
    if (C) {
        var A = function () {
            var D = (Browser.ie) ? document.body.scrollTop : window.pageYOffset;
            if (D > 39) {
                D = D - 39
            }
            C.setStyle("top", (D + 5) + "px")
        };
        if (B) {
            A();
            UI.load.fn = A.periodical(20);
            C.removeClass("hide")
        } else {
            $clear(UI.load.fn);
            C.addClass("hide")
        }
    }
};
UI.growTextarea = function (C, E, D, A) {
    if (typeof D === "undefined" || typeof D !== "boolean") {
        D = true
    }
    var G = $(C);
    if ("textarea" !== G.getTag()) {
        G = G.getElement("textarea")
    }
    var H = G.getNext();
    if (H && H.tagName.toLowerCase() === "div" && H.style.height && parseInt(H.style.height, 10) === 0) {
        H.remove()
    }
    G.setStyle("overflow", "auto");
    G.setStyle("word-wrap", "break-word");
    G.addEvent("focus", function () {
        G.addClass("focus")
    });
    G.addEvent("blur", function () {
        G.removeClass("focus")
    });
    var I = $(G.cloneNode(true));
    I.id = "";
    I.name = "";
    I.value = "";
    var F = new Element("div");
    F.setStyles({
        "overflow": "hidden",
        "height": "0",
        "margin": "0",
        "padding": "0",
        "border": "0"
    });
    I.removeClass("compressed");
    F.adopt(I);
    F.inject(G, "after");
    F = F.getElement("textarea");
    var B = function () {
        var L = G.value;
        if (!Browser.firefox) {
            L = L.replace(/\n$/g, "")
        }
        F.value = L;
        var J = F.scrollHeight;
        if (Browser.ie6 && J < 63) {
            J = 63
        } else {
            if (0 === J) {
                if (Browser.firefox) {
                    J = 20
                } else {
                    J = 28
                }
            }
        }
        if (J <= E) {
            if (G.getStyle("overflow") != "hidden") {
                G.setStyle("overflow", "hidden")
            }
            G.setStyle("height", J + "px")
        } else {
            var K = Math.min(J, E);
            G.setStyle("height", K + "px");
            G.setStyle("overflow", "auto")
        }
        if (typeof A === "function") {
            A()
        }
    };
    G.addEvent("keydown", function () {
        B.delay(10)
    });
    G.addEvent("focus", function () {
        B();
        (function () {
            G.scrollTop = G.scrollHeight
        }).delay(10)
    });
    (function () {
        B();
        if (D) {
            if (G.visible()) {
                G.focus();
                G.select()
            }
        }
    }).delay(10)
};
UI.growTextareaFromLightBox = function (A, B, C) {
    UI.growTextarea(A, B, C, function () {
        LightBox.resize()
    })
};
UI.focus = function (C, B) {
    C = $(C);
    var A;
    if (C.getTag() == "input") {
        A = [C]
    } else {
        A = C.getElements(B)
    }
    $each(A, function (D) {
        D.addEvent("focus", function () {
            D.addClass("focus")
        });
        D.addEvent("blur", function () {
            D.removeClass("focus")
        })
    })
};
UI.textarea = {
    find_cursor_coordinates_in_textarea: function (B) {
        var D;
        if ($("coords_pre")) {
            D = $("coords_pre")
        } else {
            D = document.createElement("div");
            D.id = "coords_pre";
            D = $(D);
            if (Browser.ie) {
                D.style.wordWrap = "break-word"
            } else {
                if (Browser.firefox) {
                    D.style.whiteSpace = "-moz-pre-wrap"
                } else {
                    D.style.whiteSpace = "pre-wrap"
                }
            }
        }
        D.addClass($(B).className);
        D.style.width = $(B).offsetWidth + "px";
        D.style.height = "auto";
        $(B).focus();
        var C = this.set_selection_textarea(B, 0, this.find_cursor_position_in_textarea(B));
        D.style.position = "absolute";
        D.style.top = "-10000px";
        D.style.left = "-10000px";
        document.body.appendChild(D);
        D.innerHTML = C;
        var A = D.offsetHeight - B.scrollTop + 12;
        return {
            "x": 0,
            "y": A
        }
    }, has_selected_text: function (A) {
        var B = false;
        if (typeof(A.selectionStart) == "number") {
            B = (A.selectionStart !== A.selectionEnd)
        } else {
            if (document.selection) {
                B = document.selection.createRange().duplicate().text.length > 0
            }
        }
        return B
    }, find_cursor_position_in_textarea: function (P) {
        P.focus();
        if (typeof(P.selectionStart) == "number") {
            return P.selectionStart
        } else {
            if (document.selection) {
                var N = document.selection.createRange().duplicate();
                if (N.parentElement() == P) {
                    var H = document.body.createTextRange();
                    H.moveToElementText(P);
                    H.setEndPoint("EndToStart", N);
                    var C = document.body.createTextRange();
                    C.moveToElementText(P);
                    C.setEndPoint("StartToEnd", N);
                    var I = false,
                        B = false,
                        M = false;
                    var K, G, L, A, J, F;
                    K = G = H.text;
                    L = A = N.text;
                    J = F = C.text;
                    do {
                        if (!I) {
                            if (H.compareEndPoints("StartToEnd", H) == 0) {
                                I = true
                            } else {
                                H.moveEnd("character", -1);
                                if (H.text == K) {
                                    G += "\r\n"
                                } else {
                                    I = true
                                }
                            }
                        }
                        if (!B) {
                            if (N.compareEndPoints("StartToEnd", N) == 0) {
                                B = true
                            } else {
                                N.moveEnd("character", -1);
                                if (N.text == L) {
                                    A += "\r\n"
                                } else {
                                    B = true
                                }
                            }
                        }
                        if (!M) {
                            if (C.compareEndPoints("StartToEnd", C) == 0) {
                                M = true
                            } else {
                                C.moveEnd("character", -1);
                                if (C.text == J) {
                                    F += "\r\n"
                                } else {
                                    M = true
                                }
                            }
                        }
                    } while ((!I || !B || !M));
                    var O = G + A + F;
                    var E = false;
                    if (P.value == O) {
                        E = true
                    }
                    var D = G.length;
                    return D
                }
            }
        }
    }, set_selection_textarea: function (B, D, A) {
        if (D < A) {
            var C = B.value;
            return C.substr(D, A)
        } else {
            return ""
        }
    }, insert_text_from_cursor: function (A, E, B, C) {
        var D = this.find_cursor_position_in_textarea(A);
        this._add_text(A, E, D, B, C)
    }, append_text: function (A, D, B, C) {
        this._add_text(A, D, A.value.length, B, C)
    }, _add_text: function (G, I, C, B, D) {
        var F = G.value;
        var A = F.substr(0, C);
        var H = F.substr(C, F.length);
        if (typeof B !== "undefined" && B === true) {
            var E = A.length;
            if (E > 0 && A.substring(E - 1, E) !== "\n") {
                I = "\n" + I
            }
        }
        if (typeof D !== "undefined" && D === true) {
            I = I + "\n"
        }
        G.value = A + I + H;
        this.set_cursor_position(G, (A.length + I.length))
    }, set_cursor_position: function (B, A) {
        if (B.setSelectionRange) {
            B.focus();
            B.setSelectionRange(A, A)
        } else {
            if (B.createTextRange) {
                var C = B.createTextRange();
                C.collapse(true);
                C.moveEnd("character", A);
                C.moveStart("character", A);
                C.select()
            }
        }
    }
};
UI.video = {
    url: undefined,
    post_params: undefined,
    click_with_template: function (B, E, J, G, K) {
        this.url = B;
        this.post_params = E;
        var D = "video_" + K.video_instance_id;
        var C = K.video_url;
        if (K.redirect_to_provider) {
            window.open(C)
        } else {
            var A = new Element("div").attr("id", "wrapper_" + D).setStyle("clear", "both").inject(D, "after");
            JSTemplates.load_template(J, "wrapper_" + D, "video", D, {
                "title_video": K.video_title,
                "close_button": K.localized_close
            }, {
                "close_button": function () {
                    $(D).show();
                    A.parentNode.removeChild(A);
                    return false
                }
            });
            $(D).hide();
            swfobject.embedSWF(C, "video_embed_" + D, "346", "280", "9.0.0");
            Blog.show()
        }
        var I = document.getElementsByTagName("strong");
        for (var H = 0; H < I.length; H++) {
            var F = I[H];
            if (F.id === "plays_video_" + E.video_id) {
                F.innerHTML = parseInt(F.innerHTML, 10) + 1
            }
        }
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {}, after: function (A) {}, open: function () {}, close: function () {}
};
UI.flip_pager = {
    url: undefined,
    post_params: undefined,
    click: function (B, A) {
        this.url = B;
        this.post_params = A;
        this.send()
    }, send: function () {
        Request.AJAX.send(this.url, this)
    }, before: function (A) {}, after: function (A) {
        LightBox.prepare_close()
    }, open: function () {}, close: function () {}
};
UI.external_image = function (D, B) {
    var C = $(D);
    var A = $(C.parentNode).getFirst();
    A.hide();
    C.show();
    if (C.width > B.maximum_width) {
        C.width = B.maximum_width
    }
};
UI.calendar = function (D, E) {
    this.input = D;
    this.active = false;
    E = E ? E : {};
    this.month = E.month ? E.month : ["january", "february", "march", "april", "may", "june", "july", "agust", "september", "october", "november", "december"];
    this.days = [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    this.week = E.week ? E.week : ["M", "T", "W", "T", "F", "S", "S"];
    if (E.type) {
        this.week_international = this.week
    } else {
        var F = [];
        for (var A = 0; A < this.week.length; A++) {
            F.push(this.week[A])
        }
        var B = F.pop();
        F.unshift(B);
        this.week_international = F
    }
    this.enable_past_dates = (typeof E.enable_past_dates === "boolean" && E.enable_past_dates);
    this.format = E.format ? E.format : "yyyy-mm-dd";
    this.check();
    var C = this;
    this.input.onfocus = function () {
        return C.focus()
    };
    this.input.onblur = function () {
        return C.blur()
    };
    this.input.onkeydown = function () {
        return false
    };
    if (E.date) {
        this.date = E.date.split("-")
    }
    var G = document.createElement("input");
    G.type = "hidden";
    G.name = this.input.name;
    this.input.name = "";
    G.value = this.date.join("-");
    this.hidden = G;
    this.input.parentNode.appendChild(G);
    this.calendar = document.createElement("div");
    this.input.parentNode.appendChild(this.calendar);
    this.blur()
};
UI.calendar.prototype = {
    create: function (M, f, V) {
        this.anchor = null;
        var e = new Date(M, f - 1, 1);
        var T = e.getDay() - 1;
        if (T == -1) {
            T = 6
        }
        e.days = this.days;
        e.days[1] = (((e.getFullYear() % 100 != 0) && (e.getFullYear() % 4 == 0)) || (e.getFullYear() % 400 == 0)) ? 29 : 28;
        var K = new Date();
        var Z = (M == K.getFullYear() && f == K.getMonth() + 1) ? K.getDate() : 0;
        var I = (M == this.date[0] && f == this.date[1]) ? this.date[2] : 0;
        var C = [f == 1 ? parseInt(M, 10) - 1 : M, f == 1 ? 12 : parseInt(f, 10) - 1, 1];
        var P = [f == 12 ? parseInt(M, 10) + 1 : M, f == 12 ? 1 : parseInt(f, 10) + 1, 1];
        var O = this;
        var A = document.createElement("div");
        A.className = "overlay";
        A.onmouseout = function () {
            O.active = false
        };
        A.onmouseover = function () {
            O.active = true
        };
        var N = document.createElement("div");
        N.className = "overlayBody";
        this.engine = N;
        var W = document.createElement("div");
        W.className = "calendarHeader";
        var Q = document.createElement("a");
        Q.className = "prev";
        Q.href = "javascript:void(0);";
        if (this.enable_past_dates || !this._is_past_date(C[0], C[1], this.days[C[1] - 1])) {
            Q.onmousedown = function () {
                O.set.apply(O, C);
                return false
            }
        }
        var h = document.createElement("a");
        h.innerHTML = (this.month[f - 1]) + " " + M;
        h.href = "javascript:void(0);";
        h.className = "title";
        h.onmousedown = function () {
            var a = new Date();
            O.set.apply(O, [a.getFullYear(), a.getMonth() + 1, a.getDate()]);
            return false
        };
        var X = document.createElement("a");
        X.className = "next";
        X.href = "javascript:void(0);";
        X.onmousedown = function () {
            O.set.apply(O, P);
            return false
        };
        W.appendChild(Q);
        W.appendChild(h);
        W.appendChild(X);
        var c = document.createElement("div");
        c.className = "calendarMonth";
        var S = document.createElement("div");
        var R;
        S.className = "calendarWeek";
        for (R in this.week) {
            if (!this.week.hasOwnProperty(R)) {
                continue
            }
            var L = document.createElement("span");
            L.innerHTML = this.week[R];
            S.appendChild(L)
        }
        c.appendChild(S);
        var H = document.createElement("div");
        H.className = "calendarDays";
        var E = (!this.days[f - 2]) ? 31 : this.days[f - 2],
            B = [];
        for (var U = 0; U < this.week.length; U++) {
            if (U == T) {
                break
            } else {
                B.push(E--)
            }
        }
        B.reverse();
        var G = {
            start: true,
            length: B.length
        };
        var b = this.days[f - 1];
        for (var U = 1; U <= b; U++) {
            B.push(U);
            if (B.length == 7) {
                for (var Y = 0; Y < B.length; Y++) {
                    var g;
                    if ((G.start && G.length) || (!this.enable_past_dates && this._is_past_date(M, f, B[Y]))) {
                        g = this._create_disabled_item(B[Y]);
                        if (G.length > 0) {
                            G.length--
                        } else {
                            G.start = false;
                            G.length = false
                        }
                    } else {
                        g = document.createElement("a");
                        if (B[Y] == Z) {
                            g.className = "today"
                        }
                        if (B[Y] == I) {
                            g.className = "active"
                        }
                        g.href = "javascript:void(0);";
                        g.onmousedown = function () {
                            O.select(M, f, this.innerHTML, this);
                            return false
                        };
                        g.innerHTML = B[Y]
                    }
                    H.appendChild(g)
                }
                G.start = false;
                var D = document.createElement("span");
                D.className = "clear";
                H.appendChild(D);
                B = []
            }
        }
        if (B.length) {
            for (var Y = 0; Y < B.length; Y++) {
                if ((!this.enable_past_dates && this._is_past_date(M, f, B[Y]))) {
                    H.appendChild(this._create_disabled_item(B[Y]))
                } else {
                    var g = document.createElement("a");
                    if (B[Y] == Z) {
                        g.className = "active"
                    }
                    if (B[Y] == I) {
                        g.className = "active"
                    }
                    g.href = "javascript:void(0);";
                    g.onmousedown = function () {
                        O.select(M, f, this.innerHTML, this);
                        return false
                    };
                    g.innerHTML = B[Y];
                    H.appendChild(g)
                }
            }
            var F = 7 - B.length;
            for (var U = 1; U <= F; U++) {
                H.appendChild(this._create_disabled_item(U))
            }
        }
        c.appendChild(H);
        N.appendChild(W);
        N.appendChild(c);
        var J = document.createElement("div");
        J.className = "overlayHook HookTopMiddle";
        A.appendChild(J);
        A.appendChild(N);
        return A
    }, _create_disabled_item: function (A) {
        var B = document.createElement("span");
        B.innerHTML = A;
        return B
    }, _is_past_date: function (E, G, A) {
        E = parseInt(E, 10);
        G = parseInt(G, 10);
        A = parseInt(A, 10);
        var B = new Date();
        var F = parseInt(B.getFullYear(), 10);
        var D = parseInt(B.getMonth(), 10) + 1;
        var C = parseInt(B.getDate(), 10);
        var H = false;
        if (E < F) {
            H = true
        } else {
            if (E == F) {
                if (G < D) {
                    H = true
                } else {
                    if (G == D) {
                        if (A < C) {
                            H = true
                        }
                    }
                }
            }
        }
        return H
    }, select: function (D, E, B, C) {
        if (this.anchor) {
            this.anchor.className = ""
        }
        this.anchor = C;
        C.className = "active";
        var A = new Date(D, E - 1, B);
        this.input.value = A.format(this.format);
        this.date = [D, E, B];
        this.hidden.value = A.format("yyyy-mm-dd");
        this.blur(true)
    }, set: function (B, D, A) {
        var C = this.create(B, D, A);
        this.calendar.parentNode.replaceChild(C, this.calendar);
        this.calendar = C
    }, focus: function () {
        this.calendar.style.display = "block";
        if ((!(new RegExp("(?:^|\\s+)focus(?:\\s+|$)")).test(this.input.className))) {
            this.input.className = this.input.className + " focus";
            this.set.apply(this, this.date)
        }
    }, blur: function (A) {
        if (!this.active || A) {
            this.active = false;
            this.calendar.style.display = "none";
            this.input.className = this.input.className.replace(new RegExp("(^|\\s)focus(?:\\s|$)"), "$1");
            this.input.blur()
        }
    }, check: function () {
        var A = {
            "d": "(\\d{1,2})",
            "dd": "(\\d{2})",
            "m": "(\\d{1,2})",
            "mm": "(\\d{2})",
            "y": "(\\d{1,2})",
            "yy": "(\\d{2})",
            "yyyy": "(\\d{4})"
        };
        var B = this.format.replace(/d{1,2}|m{1,4}|yy(?:yy)?/g, function (C) {
            return A[C]
        });
        this.pattern = new RegExp("^" + this.regex + "$", "g")
    }, getDate: function () {
        return this.input.value.replace(this.pattern, function (A) {})
    }
};
UI.calendarOverlay = function (D, E) {
    this.input = D;
    this.active = false;
    E = E ? E : {};
    this.month = E.month ? E.month : ["january", "february", "march", "april", "may", "june", "july", "agust", "september", "october", "november", "december"];
    this.days = [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    this.week = E.week ? E.week : ["M", "T", "W", "T", "F", "S", "S"];
    if (E.type) {
        this.week_international = this.week
    } else {
        var F = [];
        for (var A = 0; A < this.week.length; A++) {
            F.push(this.week[A])
        }
        var B = F.pop();
        F.unshift(B);
        this.week_international = F
    }
    this.enable_past_dates = (typeof E.enable_past_dates === "boolean" && E.enable_past_dates);
    this.format = E.format ? E.format : "yyyy-mm-dd";
    this.check();
    var C = this;
    this.input.onfocus = function () {
        return C.focus()
    };
    this.input.onblur = function () {
        return C.blur()
    };
    this.input.onkeydown = function () {
        return false
    };
    if (E.date) {
        this.date = E.date.split("-")
    }
    var G = document.createElement("input");
    G.type = "hidden";
    G.name = this.input.name;
    G.id = this.input.id + "_hiddenvalue";
    this.input.name = "";
    G.value = this.date.join("-");
    this.hidden = G;
    this.input.parentNode.appendChild(G);
    this.calendar = document.createElement("div");
    this.focus()
};
UI.calendarOverlay.prototype = {
    create: function (L, e, U) {
        this.anchor = null;
        var c = new Date(L, e - 1, 1);
        var S = c.getDay() - 1;
        if (S == -1) {
            S = 6
        }
        c.days = this.days;
        c.days[1] = (((c.getFullYear() % 100 != 0) && (c.getFullYear() % 4 == 0)) || (c.getFullYear() % 400 == 0)) ? 29 : 28;
        var J = new Date();
        var Y = (L == J.getFullYear() && e == J.getMonth() + 1) ? J.getDate() : 0;
        var I = (L == this.date[0] && e == this.date[1]) ? this.date[2] : 0;
        var C = [e == 1 ? parseInt(L, 10) - 1 : L, e == 1 ? 12 : parseInt(e, 10) - 1, 1];
        var O = [e == 12 ? parseInt(L, 10) + 1 : L, e == 12 ? 1 : parseInt(e, 10) + 1, 1];
        var N = this;
        var A = document.createElement("div");
        A.className = "calendarOverlay";
        A.onmouseout = function () {
            N.active = false
        };
        A.onmouseover = function () {
            N.active = true
        };
        var M = document.createElement("div");
        M.className = "calendarBody";
        this.engine = M;
        var V = document.createElement("div");
        V.className = "calendarHeader";
        if (this.enable_past_dates || !this._is_past_date(C[0], C[1], this.days[C[1] - 1])) {
            var P = document.createElement("a");
            P.className = "prev";
            P.href = "javascript:void(0);";
            P.onmousedown = function () {
                N.set.apply(N, C);
                return false
            }
        }
        var g = document.createElement("a");
        g.innerHTML = (this.month[e - 1]) + " " + L;
        g.href = "javascript:void(0);";
        g.className = "title";
        g.onmousedown = function () {
            var a = new Date();
            N.set.apply(N, [a.getFullYear(), a.getMonth() + 1, a.getDate()]);
            return false
        };
        var W = document.createElement("a");
        W.className = "next";
        W.href = "javascript:void(0);";
        W.onmousedown = function () {
            N.set.apply(N, O);
            return false
        };
        if (typeof P !== "undefined") {
            V.appendChild(P)
        }
        V.appendChild(g);
        V.appendChild(W);
        var b = document.createElement("div");
        b.className = "calendarMonth";
        var R = document.createElement("div");
        var Q;
        R.className = "calendarWeek";
        for (Q in this.week) {
            if (!this.week.hasOwnProperty(Q)) {
                continue
            }
            var K = document.createElement("span");
            K.innerHTML = this.week[Q];
            R.appendChild(K)
        }
        b.appendChild(R);
        var H = document.createElement("div");
        H.className = "calendarDays";
        var E = (!this.days[e - 2]) ? 31 : this.days[e - 2],
            B = [];
        for (var T = 0; T < this.week.length; T++) {
            if (T == S) {
                break
            } else {
                B.push(E--)
            }
        }
        B.reverse();
        var G = {
            start: true,
            length: B.length
        };
        var Z = this.days[e - 1];
        for (var T = 1; T <= Z; T++) {
            B.push(T);
            if (B.length == 7) {
                for (var X = 0; X < B.length; X++) {
                    var f;
                    if ((G.start && G.length) || (!this.enable_past_dates && this._is_past_date(L, e, B[X]))) {
                        f = this._create_disabled_item(B[X]);
                        if (G.length > 0) {
                            G.length--
                        } else {
                            G.start = false;
                            G.length = false
                        }
                    } else {
                        f = document.createElement("a");
                        if (B[X] == Y) {
                            f.className = "today"
                        }
                        if (B[X] == I) {
                            f.className = "active"
                        }
                        f.href = "javascript:void(0);";
                        f.onmousedown = function () {
                            N.select(L, e, this.innerHTML, this);
                            return false
                        };
                        f.innerHTML = B[X]
                    }
                    H.appendChild(f)
                }
                G.start = false;
                var D = document.createElement("span");
                D.className = "clear";
                H.appendChild(D);
                B = []
            }
        }
        if (B.length) {
            for (var X = 0; X < B.length; X++) {
                if ((!this.enable_past_dates && this._is_past_date(L, e, B[X]))) {
                    H.appendChild(this._create_disabled_item(B[X]))
                } else {
                    var f = document.createElement("a");
                    if (B[X] == Y) {
                        f.className = "active"
                    }
                    if (B[X] == I) {
                        f.className = "active"
                    }
                    f.href = "javascript:void(0);";
                    f.onmousedown = function () {
                        N.select(L, e, this.innerHTML, this);
                        return false
                    };
                    f.innerHTML = B[X];
                    H.appendChild(f)
                }
            }
            var F = 7 - B.length;
            for (var T = 1; T <= F; T++) {
                H.appendChild(this._create_disabled_item(T))
            }
        }
        b.appendChild(H);
        M.appendChild(V);
        M.appendChild(b);
        A.appendChild(M);
        return A
    }, _create_disabled_item: function (A) {
        var B = document.createElement("span");
        B.innerHTML = A;
        return B
    }, _is_past_date: function (E, G, A) {
        E = parseInt(E, 10);
        G = parseInt(G, 10);
        A = parseInt(A, 10);
        var B = new Date();
        var F = parseInt(B.getFullYear(), 10);
        var D = parseInt(B.getMonth(), 10) + 1;
        var C = parseInt(B.getDate(), 10);
        var H = false;
        if (E < F) {
            H = true
        } else {
            if (E == F) {
                if (G < D) {
                    H = true
                } else {
                    if (G == D) {
                        if (A < C) {
                            H = true
                        }
                    }
                }
            }
        }
        return H
    }, select: function (D, E, B, C) {
        var A = new Date(D, E - 1, B);
        this.input.value = A.format(this.format);
        this.date = [D, E, B];
        this.hidden.value = A.format("yyyy-mm-dd");
        this.blur()
    }, set: function (B, D, A) {
        var C = this.create(B, D, A);
        if (typeof this.overlay === "undefined") {
            this.overlay = new Overlay({
                targetPoint: {
                    position: "bm",
                    element: this.input,
                    follow: false,
                    offsetX: 4
                }, sourcePoint: {
                    position: "tm"
                }, content: C,
                animation: {
                    enabled: true
                }, hook: {}, close: {
                    element: "clickout"
                }
            })
        } else {
            this.overlay.setContent(C)
        }
        this.overlay.show();
        this.calendar = C
    }, focus: function () {
        this.set.apply(this, this.date)
    }, blur: function () {
        this.overlay.destroy();
        this.input.blur()
    }, check: function () {
        var A = {
            "d": "(\\d{1,2})",
            "dd": "(\\d{2})",
            "m": "(\\d{1,2})",
            "mm": "(\\d{2})",
            "y": "(\\d{1,2})",
            "yy": "(\\d{2})",
            "yyyy": "(\\d{4})"
        };
        var B = this.format.replace(/d{1,2}|m{1,4}|yy(?:yy)?/g, function (C) {
            return A[C]
        });
        this.pattern = new RegExp("^" + this.regex + "$", "g")
    }, getDate: function () {
        return this.input.value.replace(this.pattern, function (A) {})
    }
};
UI.time = function (B, C) {
    this.input = B;
    this.checkbox = C;
    this.active = false;
    var A = this;
    this.input.onfocus = function () {
        return A.focus()
    };
    this.input.onblur = function () {
        A.input.checkContent();
        A.input.className = A.input.className.replace(new RegExp("(^|\\s)focus(?:\\s|$)"), "$1");
        return A.blur()
    };
    this.input.onkeydown = function (E) {
        var D = Browser.ie ? event.keyCode : E.keyCode;
        if (D == 27) {
            A.blur()
        }
        return true
    };
    this.input.onkeyup = function () {
        A.input.checkContent()
    };
    this.input.checkContent = function () {
        if (!(new RegExp("^(([0-1][0-9])|(2[0-3])):[0-5][0-9]$").test(A.input.value))) {
            if (!(new RegExp("error").test(A.input.className))) {
                A.input.className = A.input.className + " error"
            }
        } else {
            A.input.className = A.input.className.replace(new RegExp(" error"), "")
        }
    };
    this.checkbox.onclick = function () {
        if (this.checked) {
            A.input.value = "";
            A.input.style.display = "none"
        } else {
            A.input.style.display = "inline"
        }
    };
    this.time = this.input.value;
    this.calendarTime = document.createElement("div");
    this.input.parentNode.appendChild(this.calendarTime)
};
UI.time.prototype = {
    create: function (B) {
        var I = this;
        this.anchor = null;
        var C = document.createElement("div");
        C.className = "overlay calendarTime";
        C.onmouseout = function () {
            I.active = false
        };
        C.onmouseover = function () {
            I.active = true
        };
        var A = document.createElement("div");
        A.className = "overlayBody";
        this.engine = A;
        var E = document.createElement("div");
        E.className = "calendarBody";
        var F = ["12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11"];
        for (var D = 0; D < F.length; D++) {
            var H = document.createElement("a");
            if ((F[D] + ":00") == this.time) {
                H.className = "active"
            }
            H.href = "javascript:void(0);";
            H.onmousedown = function () {
                I.select(this.innerHTML, this);
                return false
            };
            H.innerHTML = F[D] + ":00";
            E.appendChild(H)
        }
        var G = document.createElement("div");
        G.className = "overlayHook HookTopMiddle";
        C.appendChild(G);
        A.appendChild(E);
        C.appendChild(A);
        return C
    }, set: function (B) {
        var A = this.create(B);
        this.calendarTime.parentNode.replaceChild(A, this.calendarTime);
        this.calendarTime = A
    }, select: function (B, A) {
        if (this.anchor) {
            this.anchor.className = ""
        }
        this.active = false;
        this.anchor = A;
        A.className = "active";
        this.input.value = B;
        this.time = B;
        this.blur(true)
    }, focus: function () {
        this.calendarTime.style.display = "block";
        if ((!(new RegExp("(?:^|\\s+)focus(?:\\s+|$)")).test(this.input.className))) {
            this.input.className = this.input.className + " focus";
            this.set.call(this, this.time)
        }
    }, blur: function (A) {
        if (!this.active || A) {
            this.active = false;
            this.calendarTime.style.display = "none"
        }
    }
};
Date.prototype.format = function (E) {
    var D = /d{1,2}|m{1,4}|yy(?:yy)?|(H){1,2}|(M){1,2}/g,
        F = this.getDate(),
        A = this.getMonth() + 1,
        I = this.getFullYear(),
        C = this.getHours(),
        G = this.getMinutes(),
        B = {
            "d": F,
            "dd": (F < 10) ? "0" + F : F,
            "m": A,
            "mm": (A < 10) ? "0" + A : A,
            "y": I,
            "yy": String(I).slice(2),
            "yyyy": I,
            "H": C,
            "HH": (String(C).length < 2) ? "0" + C : C,
            "M": G,
            "MM": (String(G).length < 2) ? "0" + G : G
        };
    return E.replace(D, function (H) {
        return H in B ? B[H] : B[H.slice(0, 1)]
    })
};
UI.menu = {
    sequential_id: 0,
    create: function (B, A) {
        B = $(B);
        var C = {
            menu_div: undefined,
            menu_shadow: undefined,
            menu_iframe: undefined,
            show: function () {
                this.menu_div.show();
                this.menu_shadow.show();
                this.menu_iframe.show()
            }, hide: function () {
                this.menu_div.hide();
                this.menu_shadow.hide();
                this.menu_iframe.hide()
            }, fill: function (D) {
                this.menu_div.innerHTML = "";
                this.menu_div.appendChild(D)
            }
        };
        C.id = this.sequential_id++;
        C.menu_div = document.createElement("div");
        C.menu_div.className = "menu";
        C.menu_div.style.width = (C.menu_width - 2) + "px";
        B.appendChild(C.menu_div);
        C.menu_shadow = document.createElement("div");
        C.menu_shadow.className = "shadow";
        C.menu_shadow.style.width = C.menu_width + "px";
        B.appendChild(C.menu_shadow);
        C.menu_iframe = document.createElement("iframe");
        C.menu_iframe.className = "iframe";
        C.menu_iframe.style.width = C.menu_width + "px";
        B.appendChild(C.menu_iframe);
        C.menu_div = $(C.menu_div);
        C.menu_shadow = $(C.menu_shadow);
        C.menu_iframe = $(C.menu_iframe)
    }
};
UI.highligh_feedback = function (C, D, B, A) {
    B = B || "#FFFBD9";
    A = A || "#FFFFFF";
    C = $(C);
    if (C) {
        UI.Animation.fade_to_color(C, B, A, 2000)
    }
};
UI.Feedback = {
    injection_mode: {
        before: "before",
        after: "after",
        replace: "replace"
    }, note_type: {
        alert: "alert",
        error: "error",
        success: "success"
    }, message_type: {
        event: "event",
        user: "user",
        ok: "ok"
    }
};
UI.Feedback.message_inline = {
    add: function (C, A, E, K, J, F) {
        var D = $(C);
        var I = D.id + "_feedback";
        var G = $(document.createElement("div"));
        if (J == undefined) {
            J = UI.Feedback.note_type.alert
        }
        G.className = "note " + J;
        G.id = I;
        var H = document.createElement("span");
        if (typeof K == "undefined") {
            K = UI.Feedback.message_type.user
        }
        H.className = K;
        var L = document.createElement("p");
        L.appendChild(H);
        L.innerHTML += E;
        G.appendChild(L);
        var B = $(I);
        if (A === UI.Feedback.injection_mode.replace) {
            G.inject(D, "before");
            D.remove()
        } else {
            if (B === undefined || B === null || B === false) {
                G.inject(D, A)
            } else {
                B.remove();
                G.inject(D, A)
            }
        }
    }, remove: function (B) {
        var A = $($(B).id + "_feedback");
        if (A) {
            A.remove()
        }
    }
};
UI.get_dom_element_extra_height = function (B) {
    var C = $(B.cloneNode(false));
    C.setStyles({
        "height": "1px",
        "width": "1px",
        "position": "absolute",
        "top": "0px",
        "display": "block",
        "visibility": "hidden"
    });
    C.inject(B, "after");
    var A = C.offsetHeight - 1;
    C.parentNode.removeChild(C);
    return A
};
UI.avatar_profile = function (B, A) {
    B = $(B);
    var C = B.offsetHeight;
    $("private_image").style.height = (C + 20) + "px"
};
UI.Animation = {
    bounce: function (B, E, D, C) {
        var A = function (F) {
            if (F <= 0.6) {
                return Math.pow(F * 5 / 3, 2)
            } else {
                return Math.pow((F - 0.8) * 5, 2) * 0.4 + 0.6
            }
        };
        Animation(B).from("margin-top", E + "px").to(D + "px").duration(C).ease(A).go()
    }, fade_to_color: function (B, C, A, D) {
        if (!C) {
            Animation(B).to("background-color", A).ease(Animation.ease.end).duration(D).go()
        } else {
            Animation(B).from("background-color", C).to(A).ease(Animation.ease.end).duration(D).go()
        }
    }
};
UI.overflow_avatar = function (H, N, E) {
    H = $(H);
    var G = N.size;
    var K = parseInt((typeof N.x === "undefined") ? 50 : N.x, 10);
    var J = parseInt((typeof N.y === "undefined") ? 33 : N.y, 10);
    var L = H.offsetWidth;
    var B = H.offsetHeight;
    var D = parseFloat(L) / parseFloat(B);
    var F = (typeof N.forceCenter !== "undefined") && N.forceCenter;
    if (L === 0 || B == 0) {
        H.style.top = "0px";
        H.style.left = "0px"
    } else {
        var M, A, I, C;
        if (D > 1) {
            A = parseInt(1 * G * L / B, 10);
            M = G;
            I = 0;
            C = parseInt(G / 2 - A * K / 100, 10);
            if (C > 0) {
                C = 0
            } else {
                if (A < G - C) {
                    C = G - A
                }
            }
        } else {
            A = G;
            M = parseInt(1 * G * B / L, 10);
            I = -parseInt((1 * M * J / 100) - G / 2, 10);
            C = 0;
            if (I > 0) {
                I = 0
            } else {
                if (M < G - I) {
                    I = G - M
                }
            }
        }
        if (F) {
            if (A > G) {
                C = -Math.ceil((A - G) / 2)
            }
            if (M > G) {
                I = -Math.ceil((M - G) / 2)
            }
        }
        H.style.width = A + "px";
        H.style.height = M + "px";
        H.style.top = I + "px";
        H.style.left = C + "px";
        if (E) {
            $(H).setAttr("cropped", 1)
        }
    }
};
UI.has_open_applications = function () {
    return (Uploadphoto.progress.is_progress_open() || ChatDock.dock_conversations.get_total() > 0 || typeof VideoPlayer.embedded_player !== "undefined")
};
UI.prepareTemplatePrefix = function (A) {
    var B = A;
    if (!B) {
        B = ""
    } else {
        if (typeof B === "string" && B.match(/[^_]$/) || typeof B === "number") {
            B = B + "_"
        }
    }
    return B
};
UI.prepareTemplateSuffix = function (A) {
    var B = A;
    if (!B) {
        B = ""
    } else {
        if (typeof B === "string" && B.match(/^[^_]/) || typeof B === "number") {
            B = "_" + B
        }
    }
    return B
};
UI.toggleInputs = function (A, B) {
    $each(A, function (D) {
        if ($id(D)) {
            var C = $(D);
            if (B) {
                C.enable()
            } else {
                C.setAttribute("value", "");
                C.disable()
            }
        }
    })
};
UI.disableDependantCheckboxes = function (B, A) {
    $each(A, function (C) {
        if ($id(C)) {
            if ($(B).checked) {
                $(C).enable()
            } else {
                $(C).disable();
                $(C).checked = false
            }
        }
    })
};
load.trace("js/web2-Zero/1_ui.js");
var swfobject = function () {
    var AQ = "undefined",
        Ac = "object",
        AB = "Shockwave Flash",
        X = "ShockwaveFlash.ShockwaveFlash",
        Ad = "application/x-shockwave-flash",
        AC = "SWFObjectExprInst",
        AW = "onreadystatechange",
        AF = window,
        Ak = document,
        Aa = navigator,
        AA = false,
        Z = [Am],
        Af = [],
        AG = [],
        AL = [],
        Ai, AD, AP, AS, AK = false,
        At = false,
        Ag, AN, Ah = true,
        AH = function () {
            var A = typeof Ak.getElementById != AQ && typeof Ak.getElementsByTagName != AQ && typeof Ak.createElement != AQ,
                E = Aa.userAgent.toLowerCase(),
                C = Aa.platform.toLowerCase(),
                H = C ? /win/.test(C) : /win/.test(E),
                J = C ? /mac/.test(C) : /mac/.test(E),
                G = /webkit/.test(E) ? parseFloat(E.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false,
                D = !+"\v1",
                F = [0, 0, 0],
                K = null;
            if (typeof Aa.plugins != AQ && typeof Aa.plugins[AB] == Ac) {
                K = Aa.plugins[AB].description;
                if (K && !(typeof Aa.mimeTypes != AQ && Aa.mimeTypes[Ad] && !Aa.mimeTypes[Ad].enabledPlugin)) {
                    AA = true;
                    D = false;
                    K = K.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
                    F[0] = parseInt(K.replace(/^(.*)\..*$/, "$1"), 10);
                    F[1] = parseInt(K.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
                    F[2] = /[a-zA-Z]/.test(K) ? parseInt(K.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0
                }
            } else {
                if (typeof AF.ActiveXObject != AQ) {
                    try {
                        var I = new ActiveXObject(X);
                        if (I) {
                            K = I.GetVariable("$version");
                            if (K) {
                                D = true;
                                K = K.split(" ")[1].split(",");
                                F = [parseInt(K[0], 10), parseInt(K[1], 10), parseInt(K[2], 10)]
                            }
                        }
                    } catch (B) {}
                }
            }
            return {
                w3: A,
                pv: F,
                wk: G,
                ie: D,
                win: H,
                mac: J
            }
        }(),
        Aj = function () {
            if (!AH.w3) {
                return
            }
            if ((typeof Ak.readyState != AQ && Ak.readyState == "complete") || (typeof Ak.readyState == AQ && (Ak.getElementsByTagName("body")[0] || Ak.body))) {
                Ao()
            }
            if (!AK) {
                if (typeof Ak.addEventListener != AQ) {
                    Ak.addEventListener("DOMContentLoaded", Ao, false)
                }
                if (AH.ie && AH.win) {
                    Ak.attachEvent(AW, function () {
                        if (Ak.readyState == "complete") {
                            Ak.detachEvent(AW, arguments.callee);
                            Ao()
                        }
                    });
                    if (AF == top) {
                        (function () {
                            if (AK) {
                                return
                            }
                            try {
                                Ak.documentElement.doScroll("left")
                            } catch (A) {
                                setTimeout(arguments.callee, 0);
                                return
                            }
                            Ao()
                        })()
                    }
                }
                if (AH.wk) {
                    (function () {
                        if (AK) {
                            return
                        }
                        if (!/loaded|complete/.test(Ak.readyState)) {
                            setTimeout(arguments.callee, 0);
                            return
                        }
                        Ao()
                    })()
                }
                Ab(Ao)
            }
        }();

    function Ao() {
        if (AK) {
            return
        }
        try {
            var B = Ak.getElementsByTagName("body")[0].appendChild(AR("span"));
            B.parentNode.removeChild(B)
        } catch (A) {
            return
        }
        AK = true;
        var D = Z.length;
        for (var C = 0; C < D; C++) {
            Z[C]()
        }
    }
    function AJ(A) {
        if (AK) {
            A()
        } else {
            Z[Z.length] = A
        }
    }
    function Ab(A) {
        if (typeof AF.addEventListener != AQ) {
            AF.addEventListener("load", A, false)
        } else {
            if (typeof Ak.addEventListener != AQ) {
                Ak.addEventListener("load", A, false)
            } else {
                if (typeof AF.attachEvent != AQ) {
                    Al(AF, "onload", A)
                } else {
                    if (typeof AF.onload == "function") {
                        var B = AF.onload;
                        AF.onload = function () {
                            B();
                            A()
                        }
                    } else {
                        AF.onload = A
                    }
                }
            }
        }
    }
    function Am() {
        if (AA) {
            Y()
        } else {
            AM()
        }
    }
    function Y() {
        var D = Ak.getElementsByTagName("body")[0];
        var B = AR(Ac);
        B.setAttribute("type", Ad);
        var A = D.appendChild(B);
        if (A) {
            var C = 0;
            (function () {
                if (typeof A.GetVariable != AQ) {
                    var E = A.GetVariable("$version");
                    if (E) {
                        E = E.split(" ")[1].split(",");
                        AH.pv = [parseInt(E[0], 10), parseInt(E[1], 10), parseInt(E[2], 10)]
                    }
                } else {
                    if (C < 10) {
                        C++;
                        setTimeout(arguments.callee, 10);
                        return
                    }
                }
                D.removeChild(B);
                A = null;
                AM()
            })()
        } else {
            AM()
        }
    }
    function AM() {
        var G = Af.length;
        if (G > 0) {
            for (var H = 0; H < G; H++) {
                var C = Af[H].id;
                var L = Af[H].callbackFn;
                var A = {
                    success: false,
                    id: C
                };
                if (AH.pv[0] > 0) {
                    var I = Ar(C);
                    if (I) {
                        if (AO(Af[H].swfVersion) && !(AH.wk && AH.wk < 312)) {
                            AX(C, true);
                            if (L) {
                                A.success = true;
                                A.ref = AU(C);
                                L(A)
                            }
                        } else {
                            if (Af[H].expressInstall && AT()) {
                                var E = {};
                                E.data = Af[H].expressInstall;
                                E.width = I.getAttribute("width") || "0";
                                E.height = I.getAttribute("height") || "0";
                                if (I.getAttribute("class")) {
                                    E.styleclass = I.getAttribute("class")
                                }
                                if (I.getAttribute("align")) {
                                    E.align = I.getAttribute("align")
                                }
                                var F = {};
                                var D = I.getElementsByTagName("param");
                                var K = D.length;
                                for (var J = 0; J < K; J++) {
                                    if (D[J].getAttribute("name").toLowerCase() != "movie") {
                                        F[D[J].getAttribute("name")] = D[J].getAttribute("value")
                                    }
                                }
                                AE(E, F, C, L)
                            } else {
                                Ae(I);
                                if (L) {
                                    L(A)
                                }
                            }
                        }
                    }
                } else {
                    AX(C, true);
                    if (L) {
                        var B = AU(C);
                        if (B && typeof B.SetVariable != AQ) {
                            A.success = true;
                            A.ref = B
                        }
                        L(A)
                    }
                }
            }
        }
    }
    function AU(B) {
        var D = null;
        var C = Ar(B);
        if (C && C.nodeName == "OBJECT") {
            if (typeof C.SetVariable != AQ) {
                D = C
            } else {
                var A = C.getElementsByTagName(Ac)[0];
                if (A) {
                    D = A
                }
            }
        }
        return D
    }
    function AT() {
        return !At && AO("6.0.65") && (AH.win || AH.mac) && !(AH.wk && AH.wk < 312)
    }
    function AE(F, D, H, E) {
        At = true;
        AP = E || null;
        AS = {
            success: false,
            id: H
        };
        var A = Ar(H);
        if (A) {
            if (A.nodeName == "OBJECT") {
                Ai = An(A);
                AD = null
            } else {
                Ai = A;
                AD = H
            }
            F.id = AC;
            if (typeof F.width == AQ || (!/%$/.test(F.width) && parseInt(F.width, 10) < 310)) {
                F.width = "310"
            }
            if (typeof F.height == AQ || (!/%$/.test(F.height) && parseInt(F.height, 10) < 137)) {
                F.height = "137"
            }
            Ak.title = Ak.title.slice(0, 47) + " - Flash Player Installation";
            var B = AH.ie && AH.win ? "ActiveX" : "PlugIn",
                C = "MMredirectURL=" + AF.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + B + "&MMdoctitle=" + Ak.title;
            if (typeof D.flashvars != AQ) {
                D.flashvars += "&" + C
            } else {
                D.flashvars = C
            }
            if (AH.ie && AH.win && A.readyState != 4) {
                var G = AR("div");
                H += "SWFObjectNew";
                G.setAttribute("id", H);
                A.parentNode.insertBefore(G, A);
                A.style.display = "none";
                (function () {
                    if (A.readyState == 4) {
                        A.parentNode.removeChild(A)
                    } else {
                        setTimeout(arguments.callee, 10)
                    }
                })()
            }
            AZ(F, D, H)
        }
    }
    function Ae(A) {
        if (AH.ie && AH.win && A.readyState != 4) {
            var B = AR("div");
            A.parentNode.insertBefore(B, A);
            B.parentNode.replaceChild(An(A), B);
            A.style.display = "none";
            (function () {
                if (A.readyState == 4) {
                    A.parentNode.removeChild(A)
                } else {
                    setTimeout(arguments.callee, 10)
                }
            })()
        } else {
            A.parentNode.replaceChild(An(A), A)
        }
    }
    function An(B) {
        var D = AR("div");
        if (AH.win && AH.ie) {
            D.innerHTML = B.innerHTML
        } else {
            var E = B.getElementsByTagName(Ac)[0];
            if (E) {
                var A = E.childNodes;
                if (A) {
                    var F = A.length;
                    for (var C = 0; C < F; C++) {
                        if (!(A[C].nodeType == 1 && A[C].nodeName == "PARAM") && !(A[C].nodeType == 8)) {
                            D.appendChild(A[C].cloneNode(true))
                        }
                    }
                }
            }
        }
        return D
    }
    function AZ(E, G, C) {
        var D, A = Ar(C);
        if (AH.wk && AH.wk < 312) {
            return D
        }
        if (A) {
            if (typeof E.id == AQ) {
                E.id = C
            }
            if (AH.ie && AH.win) {
                var F = "";
                for (var I in E) {
                    if (E[I] != Object.prototype[I]) {
                        if (I.toLowerCase() == "data") {
                            G.movie = E[I]
                        } else {
                            if (I.toLowerCase() == "styleclass") {
                                F += ' class="' + E[I] + '"'
                            } else {
                                if (I.toLowerCase() != "classid") {
                                    F += " " + I + '="' + E[I] + '"'
                                }
                            }
                        }
                    }
                }
                var H = "";
                for (var J in G) {
                    if (G[J] != Object.prototype[J]) {
                        H += '<param name="' + J + '" value="' + G[J] + '" />'
                    }
                }
                A.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + F + ">" + H + "</object>";
                AG[AG.length] = E.id;
                D = Ar(E.id)
            } else {
                var B = AR(Ac);
                B.setAttribute("type", Ad);
                for (var K in E) {
                    if (E[K] != Object.prototype[K]) {
                        if (K.toLowerCase() == "styleclass") {
                            B.setAttribute("class", E[K])
                        } else {
                            if (K.toLowerCase() != "classid") {
                                B.setAttribute(K, E[K])
                            }
                        }
                    }
                }
                for (var L in G) {
                    if (G[L] != Object.prototype[L] && L.toLowerCase() != "movie") {
                        Ap(B, L, G[L])
                    }
                }
                A.parentNode.replaceChild(B, A);
                D = B
            }
        }
        return D
    }
    function Ap(B, D, C) {
        var A = AR("param");
        A.setAttribute("name", D);
        A.setAttribute("value", C);
        B.appendChild(A)
    }
    function AV(A) {
        var B = Ar(A);
        if (B && B.nodeName == "OBJECT") {
            if (AH.ie && AH.win) {
                B.style.display = "none";
                (function () {
                    if (B.readyState == 4) {
                        As(A)
                    } else {
                        setTimeout(arguments.callee, 10)
                    }
                })()
            } else {
                B.parentNode.removeChild(B)
            }
        }
    }
    function As(A) {
        var B = Ar(A);
        if (B) {
            for (var C in B) {
                if (typeof B[C] == "function") {
                    B[C] = null
                }
            }
            B.parentNode.removeChild(B)
        }
    }
    function Ar(A) {
        var C = null;
        try {
            C = Ak.getElementById(A)
        } catch (B) {}
        return C
    }
    function AR(A) {
        return Ak.createElement(A)
    }
    function Al(A, C, B) {
        A.attachEvent(C, B);
        AL[AL.length] = [A, C, B]
    }
    function AO(A) {
        var B = AH.pv,
            C = A.split(".");
        C[0] = parseInt(C[0], 10);
        C[1] = parseInt(C[1], 10) || 0;
        C[2] = parseInt(C[2], 10) || 0;
        return (B[0] > C[0] || (B[0] == C[0] && B[1] > C[1]) || (B[0] == C[0] && B[1] == C[1] && B[2] >= C[2])) ? true : false
    }
    function AY(B, F, A, C) {
        if (AH.ie && AH.mac) {
            return
        }
        var E = Ak.getElementsByTagName("head")[0];
        if (!E) {
            return
        }
        var G = (A && typeof A == "string") ? A : "screen";
        if (C) {
            Ag = null;
            AN = null
        }
        if (!Ag || AN != G) {
            var D = AR("style");
            D.setAttribute("type", "text/css");
            D.setAttribute("media", G);
            Ag = E.appendChild(D);
            if (AH.ie && AH.win && typeof Ak.styleSheets != AQ && Ak.styleSheets.length > 0) {
                Ag = Ak.styleSheets[Ak.styleSheets.length - 1]
            }
            AN = G
        }
        if (AH.ie && AH.win) {
            if (Ag && typeof Ag.addRule == Ac) {
                Ag.addRule(B, F)
            }
        } else {
            if (Ag && typeof Ak.createTextNode != AQ) {
                Ag.appendChild(Ak.createTextNode(B + " {" + F + "}"))
            }
        }
    }
    function AX(A, C) {
        if (!Ah) {
            return
        }
        var B = C ? "visible" : "hidden";
        if (AK && Ar(A)) {
            Ar(A).style.visibility = B
        } else {
            AY("#" + A, "visibility:" + B)
        }
    }
    function AI(B) {
        var A = /[\\\"<>\.;]/;
        var C = A.exec(B) != null;
        return C && typeof encodeURIComponent != AQ ? encodeURIComponent(B) : B
    }
    var Aq = function () {
        if (AH.ie && AH.win) {
            window.attachEvent("onunload", function () {
                var A = AL.length;
                for (var B = 0; B < A; B++) {
                    AL[B][0].detachEvent(AL[B][1], AL[B][2])
                }
                var D = AG.length;
                for (var C = 0; C < D; C++) {
                    AV(AG[C])
                }
                for (var E in AH) {
                    AH[E] = null
                }
                AH = null;
                for (var F in swfobject) {
                    swfobject[F] = null
                }
                swfobject = null
            })
        }
    }();
    return {
        registerObject: function (A, E, C, B) {
            if (AH.w3 && A && E) {
                var D = {};
                D.id = A;
                D.swfVersion = E;
                D.expressInstall = C;
                D.callbackFn = B;
                Af[Af.length] = D;
                AX(A, false)
            } else {
                if (B) {
                    B({
                        success: false,
                        id: A
                    })
                }
            }
        }, getObjectById: function (A) {
            if (AH.w3) {
                return AU(A)
            }
        }, embedSWF: function (K, E, H, F, C, A, B, I, G, J) {
            var D = {
                success: false,
                id: E
            };
            if (AH.w3 && !(AH.wk && AH.wk < 312) && K && E && H && F && C) {
                AX(E, false);
                AJ(function () {
                    H += "";
                    F += "";
                    var Q = {};
                    if (G && typeof G === Ac) {
                        for (var O in G) {
                            Q[O] = G[O]
                        }
                    }
                    Q.data = K;
                    Q.width = H;
                    Q.height = F;
                    var N = {};
                    if (I && typeof I === Ac) {
                        for (var P in I) {
                            N[P] = I[P]
                        }
                    }
                    if (B && typeof B === Ac) {
                        for (var L in B) {
                            if (typeof N.flashvars != AQ) {
                                N.flashvars += "&" + L + "=" + B[L]
                            } else {
                                N.flashvars = L + "=" + B[L]
                            }
                        }
                    }
                    if (AO(C)) {
                        var M = AZ(Q, N, E);
                        if (Q.id == E) {
                            AX(E, true)
                        }
                        D.success = true;
                        D.ref = M
                    } else {
                        if (A && AT()) {
                            Q.data = A;
                            AE(Q, N, E, J);
                            return
                        } else {
                            AX(E, true)
                        }
                    }
                    if (J) {
                        J(D)
                    }
                })
            } else {
                if (J) {
                    J(D)
                }
            }
        }, switchOffAutoHideShow: function () {
            Ah = false
        }, ua: AH,
        getFlashPlayerVersion: function () {
            return {
                major: AH.pv[0],
                minor: AH.pv[1],
                release: AH.pv[2]
            }
        }, hasFlashPlayerVersion: AO,
        createSWF: function (A, B, C) {
            if (AH.w3) {
                return AZ(A, B, C)
            } else {
                return undefined
            }
        }, showExpressInstall: function (B, A, D, C) {
            if (AH.w3 && AT()) {
                AE(B, A, D, C)
            }
        }, removeSWF: function (A) {
            if (AH.w3) {
                AV(A)
            }
        }, createCSS: function (B, A, C, D) {
            if (AH.w3) {
                AY(B, A, C, D)
            }
        }, addDomLoadEvent: AJ,
        addLoadEvent: Ab,
        getQueryParamValue: function (B) {
            var A = Ak.location.search || Ak.location.hash;
            if (A) {
                if (/\?/.test(A)) {
                    A = A.split("?")[1]
                }
                if (B == null) {
                    return AI(A)
                }
                var C = A.split("&");
                for (var D = 0; D < C.length; D++) {
                    if (C[D].substring(0, C[D].indexOf("=")) == B) {
                        return AI(C[D].substring((C[D].indexOf("=") + 1)))
                    }
                }
            }
            return ""
        }, expressInstallCallback: function () {
            if (At) {
                var A = Ar(AC);
                if (A && Ai) {
                    A.parentNode.replaceChild(Ai, A);
                    if (AD) {
                        AX(AD, true);
                        if (AH.ie && AH.win) {
                            Ai.style.display = "block"
                        }
                    }
                    if (AP) {
                        AP(AS)
                    }
                }
                At = false
            }
        }
    }
}();
load.trace("js/web2-Zero/1_swfobject.js");
if (typeof UI === "undefined") {
    var UI = {
        load: function () {}
    }
}
var RequestEngine = {
    _config: undefined,
    _current_page: undefined,
    init: function () {
        if ($("request_engine_config")) {
            this._config = JSON.decode($("request_engine_config").getAttribute("config"))
        }
    }, is_initialized: function () {
        return typeof this._config !== "undefined"
    }
};
RequestEngine.Routing = {
    resolve_client_routing: function (B, H) {
        var A = false;
        var C = B;
        H = (H) || false;
        var E = B.match(/(?:(https?):\/\/)?(?:\[([^\]]+)\])?(?:([^.]+)\.)?/i);
        var G = (E !== null && typeof E[1] !== "undefined" && E[1] !== "") ? E[1] : undefined;
        var D = (E !== null && typeof E[2] !== "undefined" && E[2] !== "") ? E[2] : undefined;
        var F = (E !== null && typeof E[3] !== "undefined" && E[3] !== "") ? E[3] : undefined;
        A = this._is_photo_upload(F);
        if (!A) {
            A = this._is_htpps(G);
            if (!A) {
                C = "http://" + ClientRouter.get_failover_farm() + ClientRouter.server_name + "/" + B;
                if (!H && typeof D !== "undefined") {
                    B = this.clean_url_from_farm_garbage(B);
                    C = "http://" + D + ClientRouter.server_name + "/" + B
                } else {
                    C = "http://" + ClientRouter.get_home_farm() + ClientRouter.server_name + "/" + B
                }
            }
        }
        return C
    }, _is_photo_upload: function (A) {
        return typeof A !== "undefined" && A === ClientRouter.upload_server
    }, _is_htpps: function (A) {
        return typeof A !== "undefined" && A === "https"
    }, clean_url_from_farm_garbage: function (A) {
        return A.replace(/(\[[^\]]+\])/i, "")
    }, get_farm_from_url: function (A) {
        var B = A.match(/\[([^\]]+)\]/i);
        return (B !== null && typeof B[1] !== "undefined") ? B[1] : undefined
    }
};
RequestEngine.IFRAME = {
    iframe_unique_counter: 0,
    iframe_pool: [],
    submit_form: function (C, D, E, A) {
        D = D || undefined;
        var G = RequestEngine.IFRAME.get_controller(C, D);
        C = RequestEngine.Routing.resolve_client_routing(C, false);
        if (D != undefined && D.post_params && !isObjectEmpty(D.get_params)) {
            C = this.complete_url(C, D.get_params)
        }
        E.action = C;
        E.target = G.get_iframe_element_id();
        E.setAttribute("target", G.get_iframe_element_id());
        E.setAttribute("method", "post");
        var B = D.post_params;
        for (param_name in B) {
            if (!B.hasOwnProperty(param_name)) {
                continue
            }
            param_value = B[param_name];
            var F = document.createElement("input");
            F.setAttribute("type", "hidden");
            F.setAttribute("name", param_name);
            F.setAttribute("value", param_value);
            E.appendChild(F)
        }
        if (typeof A == "undefined" || A) {
            UI.load(true)
        }
        this.request_module = D;
        E.submit()
    }, send: function (A, C, J) {
        C = C || undefined;
        var I = RequestEngine.IFRAME.get_controller(A, C);
        A = RequestEngine.Routing.resolve_client_routing(A, false);
        if (C != undefined && C.post_params && !isObjectEmpty(C.get_params)) {
            A = this.complete_url(A, C.get_params)
        }
        if (C != undefined && C.post_params && !isObjectEmpty(C.post_params)) {
            var B = document.createElement("form");
            B.setAttribute("action", A);
            B.setAttribute("method", "post");
            B.target = I.get_iframe_element_id();
            var D = C.post_params;
            var F;
            var H;
            for (F in D) {
                if (!D.hasOwnProperty(F)) {
                    continue
                }
                H = D[F];
                var G;
                if (H.constructor == Array || F.match(/\[ *\]$/)) {
                    for (var E = 0; E < H.length; E++) {
                        G = document.createElement("input");
                        G.setAttribute("type", "hidden");
                        G.setAttribute("name", F);
                        G.setAttribute("value", H[E]);
                        B.appendChild(G)
                    }
                } else {
                    G = document.createElement("input");
                    G.setAttribute("type", "hidden");
                    G.setAttribute("name", F);
                    G.setAttribute("value", H);
                    B.appendChild(G)
                }
            }
            document.body.appendChild(B);
            B.submit();
            document.body.removeChild(B)
        } else {
            if (typeof J === "undefined" || J) {
                UI.load(true)
            }
            I.set_url(A)
        }
    }, get_controller: function (B, C) {
        var G = {
            request_module: undefined,
            iframe_id: undefined,
            iframe: undefined,
            set_url: function (K) {
                try {
                    if (Browser.ie) {
                        this.iframe.src = K;
                        frames[this.get_iframe_element_id()].document.location = K
                    } else {
                        this.iframe.src = K
                    }
                } catch (J) {
                    if (J.number === -2146828218) {
                        UI.load(false);
                        return false
                    } else {
                        if (J.number === -2147024891) {
                            UI.load(false);
                            return false
                        } else {
                            throw J
                        }
                    }
                }
            }, clear: function () {
                if (this.iframe_id === "persistent") {} else {
                    var J = this;
                    setTimeout(function () {
                        J.iframe.parentNode.removeChild(J.iframe)
                    }, 400)
                }
            }, get_iframe_element_id: function () {
                return "goto_" + this.iframe_id
            }
        };
        G.request_module = C;
        var F;
        var D;
        var E;
        var I;
        F = RequestEngine.IFRAME.iframe_unique_counter++;
        E = null;
        D = "goto_" + F;
        if (Browser.ie) {
            I = document.createElement("div");
            I.innerHTML = '<iframe id="' + D + '" name="' + D + '" width="0" height="0" style="display:none"></iframe>';
            E = I.firstChild
        } else {
            E = document.createElement("iframe");
            E.id = D;
            E.name = E.id;
            E.src = "about:blank";
            E.height = "0";
            E.width = "0";
            E.style.display = "none"
        }
        document.body.appendChild(E);
        RequestEngine.IFRAME.iframe_pool[F] = G;
        G.iframe_id = F;
        G.iframe = E;
        var A = (function (J) {
            return function (L) {
                var Q;
                if (Browser.ie) {
                    Q = L.srcElement
                } else {
                    if (Browser.firefox2) {
                        Q = L.currentTarget
                    } else {
                        Q = L.target
                    }
                }
                if (Browser.ie && (!Q || Q === null)) {
                    return false
                }
                var P = Q.id;
                var X = RequestEngine.IFRAME.iframe_pool[P.split("_")[1]];
                try {
                    var R = frames[P].document.body
                } catch (Y) {
                    if (Y.number === -2146828218) {
                        UI.load(false);
                        return false
                    } else {
                        if (Y.number === -2147024891) {
                            UI.load(false);
                            return false
                        } else {
                            throw Y
                        }
                    }
                }
                if (!R.childNodes.length) {
                    return false
                }
                var V = frames[P].document.getElementById("request_data");
                if (Browser.ie && typeof X === "undefined") {
                    return false
                }
                Request.AJAX.before(X.request_module, V);
                for (var S in R.childNodes) {
                    var N = R.childNodes[S];
                    if (N.nodeType == 1 && N.nodeName.toUpperCase() == "XMP") {
                        var M = N.getAttribute("id");
                        var U = N.innerHTML;
                        var W = null;
                        if (M) {
                            W = $(M)
                        }
                        if (W !== null) {
                            if (M !== "request_data") {
                                W.innerHTML = U.replace(/^[^<]*<(?:div|tr|h\d)[^>]*>/i, "").replace(/<\/(?:div|tr|h\d)>[ \t\r\n]*$/i, "");
                                var T = U.match(/^[^<]*<(?:div|tr|h\d)[^>]+class\s*=\s*"([^"]+)"[^>]*>/i);
                                if (T) {
                                    var K = T[1].split(/\s+/);
                                    for (var O = 0; O < K.length; O++) {
                                        if (typeof W.addClass !== "undefined") {
                                            W.addClass(K[O])
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                UI.load(false);
                if (X.request_module !== undefined && X.request_module !== null && X.request_module.after) {
                    X.request_module.after(V)
                }
                if (DEBUG === false && Q.id !== "goto_persistent") {
                    X.clear();
                    delete RequestEngine.IFRAME.iframe_pool[X.iframe_id]
                }
            }
        })();
        if (document.attachEvent) {
            try {
                E.attachEvent("onload", A)
            } catch (H) {
                if (H.number === -2146828218) {
                    UI.load(false);
                    return false
                } else {
                    setTimeout(function () {
                        try {
                            E.attachEvent("onload", A)
                        } catch (J) {
                            return false
                        }
                    }, 10)
                }
            }
        } else {
            E.addEventListener("load", A, false)
        }
        return G
    }, complete_url: function (A, D) {
        for (var E in D) {
            if (!D.hasOwnProperty(E)) {
                continue
            }
            var C = "";
            if (typeof D[E] === "object") {
                var F = D[E];
                for (var B = 0; B < F.length; B++) {
                    C += "&" + E + "=" + encodeURIComponent(F[B])
                }
            } else {
                C = "&" + E + "=" + encodeURIComponent(D[E])
            }
            A += C
        }
        return A
    }
};
RequestEngine.AJAX = {
    _is_crossdomain_ajax_native: false,
    _is_config_loaded: false,
    timeout_manager: function () {
        var D = 3;
        var B = {};
        var A = function (E) {
            if (typeof B[E] == "undefined") {
                B[E] = D
            } else {
                B[E]--;
                if (B[E] < 0) {
                    delete B[E]
                }
            }
        };
        var C = function (E) {
            return (B[E] >= 0)
        };
        return {
            mark_farm: A,
            is_timedout: C
        }
    }(),
    handle_timeout: function (A) {
        var B = A.get_request_object();
        this.timeout_manager.mark_farm(B.farm);
        this.send(B.original_url, B.module)
    }, _build_request_object: function (D, A, B, C) {
        B = B || {};
        return new Web2RequestObject({
            "url": this._iframe_controller._get_request_host(D) + RequestEngine.Routing.clean_url_from_farm_garbage(A),
            "module": B,
            "force_not_cancel": C,
            "farm": D,
            "original_url": A
        })
    }, _enforce_config_is_loaded: function () {
        if (!this._is_config_loaded && !RequestEngine.is_initialized()) {
            RequestEngine.init();
            this._is_config_loaded = true
        }
    }, send: function (B, C, A) {
        this._enforce_config_is_loaded();
        A = typeof A === "undefined" ? true : A;
        UI.load(A);
        var E = undefined;
        C = C || undefined;
        var D = false;
        if (typeof C !== "undefined") {
            D = (typeof C.force_not_cancel !== "undefined") ? C.force_not_cancel : false
        }
        if (C !== undefined && C.get_params && !isObjectEmpty(C.get_params)) {
            B = this.complete_url(B, C.get_params)
        }
        if (ClientRouter._client_side_router_override) {
            E = ClientRouter.get_home_farm()
        } else {
            E = RequestEngine.Routing.get_farm_from_url(B)
        }
        if (typeof E === "undefined") {
            E = ClientRouter.get_home_farm()
        }
        if (this.timeout_manager.is_timedout(E)) {
            this.timeout_manager.mark_farm(E);
            E = ClientRouter.get_failover_farm()
        }
        if (typeof StateManager !== "undefined") {
            StateManager.store_in_history_if_needed(RequestEngine.Routing.clean_url_from_farm_garbage(B))
        }
        if (typeof E !== "undefined") {
            if (E === ClientRouter.get_failover_farm() && !ClientRouter._client_side_router_override) {
                this._perform_request_to_native_ajax(E, B, C, D)
            } else {
                if (!this._iframe_controller.have_controller_for_farm(E)) {
                    if (this._iframe_controller.iframe_for_farm_failed_to_load(E) === true) {
                        this._perform_request_to_native_ajax(ClientRouter.get_failover_farm(), B, C, D)
                    } else {
                        this._iframe_controller.create_controller_for_farm(E, function () {
                            RequestEngine.AJAX._perform_request_to_iframe_controller(E, B, C, true)
                        }, function () {
                            RequestEngine.AJAX._perform_request_to_native_ajax(ClientRouter.get_failover_farm(), B, C, true)
                        })
                    }
                } else {
                    RequestEngine.AJAX._perform_request_to_iframe_controller(E, B, C, D)
                }
            }
        } else {}
    }, submit_form: function (C, D, E, A) {
        this._enforce_config_is_loaded();
        var B = this._form_handler.get_post_params_from_form(E);
        if (typeof D.post_params === "undefined" && !isObjectEmpty(B)) {
            D.post_params = {}
        }
        for (var F in B) {
            if (!B.hasOwnProperty(F)) {
                continue
            }
            D.post_params[F] = B[F]
        }
        this.send(C, D, A)
    }, _perform_request_to_iframe_controller: function (D, A, B, C) {
        $(this._iframe_controller.get_controller_for_farm(D)).contentWindow.Web2RequestHandler.handle_request(this._build_request_object(D, A, B, C))
    }, _perform_request_to_native_ajax: function (D, A, B, C) {
        var E = this._build_request_object(D, A, B, C);
        E.on_success = {
            "method": RequestEngine.AJAX.Web2ResponseHandler.handle_response,
            "scope": RequestEngine.AJAX.Web2ResponseHandler
        };
        E.on_internal_server_error = {
            "method": RequestEngine.AJAX.Web2ResponseHandler.handle_response,
            "scope": RequestEngine.AJAX.Web2ResponseHandler
        };
        E.on_forbidden = {
            "method": RequestEngine.AJAX.Web2ResponseHandler.handle_response,
            "scope": RequestEngine.AJAX.Web2ResponseHandler
        };
        XMLHttpObjectHandler.RequestFactory.send_request(E)
    }, complete_url: function (A, D) {
        for (var E in D) {
            if (!D.hasOwnProperty(E)) {
                continue
            }
            var C = "";
            if (typeof D[E] === "object") {
                var F = D[E];
                for (var B = 0; B < F.length; B++) {
                    C += "&" + E + "=" + encodeURIComponent(F[B])
                }
            } else {
                C = "&" + E + "=" + encodeURIComponent(D[E])
            }
            A += C
        }
        return A
    }, _form_handler: {
        valid_types: ["input", "select", "textarea"],
        type_handlers: {
            is_element_valid: function (A) {
                return !(!A.name || A.disabled || A.type == "submit" || A.type == "reset" || A.type == "file")
            }, input: {
                is_this_type: function (A) {
                    return ($(A).getTag() === "input")
                }, get_value: function (A) {
                    var B = undefined;
                    if (($(A).type == "radio" || $(A).type == "checkbox") && $(A).checked) {
                        B = $(A).value
                    } else {
                        if ($(A).type == "text" || $(A).type == "hidden" || $(A).type == "password") {
                            B = (typeof $(A).value !== "undefined") ? $(A).value : undefined
                        }
                    }
                    return {
                        "key": $(A).name,
                        "value": B
                    }
                }
            }, select: {
                is_this_type: function (A) {
                    return ($(A).getTag() === "select")
                }, get_value: function (A) {
                    A = $(A);
                    var B = undefined;
                    if (A.multiple) {
                        B = new Array();
                        while (A.selectedIndex != -1) {
                            B.push(A.options[A.selectedIndex].value);
                            A.options[A.selectedIndex].selected = false
                        }
                    } else {
                        if (A.selectedIndex != -1) {
                            B = A.options[A.selectedIndex].value
                        }
                    }
                    return {
                        "key": A.name,
                        "value": B
                    }
                }
            }, textarea: {
                is_this_type: function (A) {
                    return ($(A).getTag() === "textarea")
                }, get_value: function (A) {
                    return {
                        "key": $(A).name,
                        "value": $(A).value
                    }
                }
            }
        }, _is_input_name_array: function (A) {
            return A.indexOf("[") !== -1 && A.indexOf("]") !== -1
        }, get_post_params_from_form: function (D) {
            var K = $(D).getElements("input");
            var C = $(D).getElements("select");
            var B = $(D).getElements("textarea");
            var A = K.concat(C).concat(B);
            var E = {};
            for (var I = 0; I < A.length; I++) {
                var J = A[I];
                if (this.type_handlers.is_element_valid(J)) {
                    var F = false;
                    for (var G = 0; G < this.valid_types.length && !F; G++) {
                        if (this.type_handlers[this.valid_types[G]].is_this_type(J)) {
                            var H = this.type_handlers[this.valid_types[G]].get_value(J);
                            if (typeof H.value !== "undefined") {
                                if (this._is_input_name_array(H.key)) {
                                    H.key = H.key.substr(0, H.key.indexOf("["));
                                    if (typeof E[H.key] === "undefined") {
                                        E[H.key] = {
                                            "is_array": true,
                                            "array_values": []
                                        }
                                    }
                                    if (H.value.constructor !== Array) {
                                        E[H.key]["array_values"].push(H.value)
                                    } else {
                                        E[H.key]["array_values"] = E[H.key]["array_values"].concat(H.value)
                                    }
                                } else {
                                    E[H.key] = H.value
                                }
                                F = true
                            }
                        }
                    }
                }
            }
            return E
        }
    }, _iframe_controller: {
        iframe_id_prefix: "request_engine_web2_",
        _receiver_filename: REQUEST_ENGINE_RECEIVER_FILENAME,
        _controller_pool: [],
        _failed_iframes_pool: [],
        _controllers_in_process_callback_stack: {}, iframe_for_farm_failed_to_load: function (A) {
            return typeof this._failed_iframes_pool[this._build_id_for_iframe_controller(A)] !== "undefined"
        }, _build_controller_url: function (A) {
            return this._get_request_host(A) + this._receiver_filename
        }, _get_request_host: function (B) {
            var A = location.host.match(/tuenti\.com(?:$|:)/) ? "tuenti.com" : "tuenti.local";
            return "http://" + B + "." + A + "/"
        }, _build_id_for_iframe_controller: function (A) {
            return this.iframe_id_prefix + A
        }, have_controller_for_farm: function (A) {
            return typeof this._controller_pool[this._build_id_for_iframe_controller(A)] !== "undefined"
        }, get_controller_for_farm: function (A) {
            return this._controller_pool[this._build_id_for_iframe_controller(A)]
        }, _is_controller_being_created: function (A) {
            return typeof this._controllers_in_process_callback_stack[A] !== "undefined"
        }, create_controller_for_farm: function (C, D, B) {
            if (!this._is_controller_being_created(C)) {
                this._controllers_in_process_callback_stack[C] = [D];
                var A = document.createElement("iframe");
                A.src = this._build_controller_url(C);
                A.id = this._build_id_for_iframe_controller(C);
                A.className = "hide";
                if (typeof D !== "undefined") {
                    $(A).addEvent("load", function () {
                        var J = A.contentWindow;
                        var I = false;
                        try {
                            var H = J.Web2RequestHandler;
                            var I = true
                        } catch (G) {}
                        if (I === false) {
                            RequestEngine.AJAX._iframe_controller._failed_iframes_pool[A.id] = A;
                            if (typeof B == "function") {
                                B.call()
                            }
                        } else {
                            RequestEngine.AJAX._iframe_controller._controller_pool[A.id] = A;
                            for (var E in RequestEngine.AJAX._iframe_controller._controllers_in_process_callback_stack) {
                                if (!RequestEngine.AJAX._iframe_controller._controllers_in_process_callback_stack.hasOwnProperty(E)) {
                                    continue
                                }
                                for (var F = 0; F < RequestEngine.AJAX._iframe_controller._controllers_in_process_callback_stack[E].length; F++) {
                                    if (typeof RequestEngine.AJAX._iframe_controller._controllers_in_process_callback_stack[E][F] === "function") {
                                        RequestEngine.AJAX._iframe_controller._controllers_in_process_callback_stack[E][F].call();
                                        RequestEngine.AJAX._iframe_controller._controllers_in_process_callback_stack[E][F] = undefined
                                    }
                                }
                            }
                        }
                    })
                }
                document.body.appendChild(A)
            } else {
                this._controllers_in_process_callback_stack[C].push(D)
            }
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler = {
    processors: [],
    add_processor: function (A) {
        if (typeof A.process === "function") {
            this.processors.push(A)
        } else {
            throw "You must implement the process method in the processor"
        }
    }, handle_response: function (B) {
        if (B.success === true && (XMLHttpObjectHandler.ResponseStateManager.is_success(B.return_code)) || (B.return_code === null)) {
            for (var A = 0; A < this.processors.length; A++) {
                if (typeof this.processors[A].process !== "undefined") {
                    this.processors[A].process.call(this.processors[A], B)
                }
            }
        } else {
            switch (B.return_code) {
            case XMLHttpObjectHandler.ResponseStateManager.response_status.INTERNAL_SERVER_ERROR:
            case XMLHttpObjectHandler.ResponseStateManager.response_status.FORBIDDEN:
                break
            }
            var C = B.get_request_object();
            if (C.has_module() && C.get_module().feedback_submit_button) {
                C.get_module().feedback_submit_button.fail()
            }
            FeedbackController.createErrorConfirmFeedback(RequestEngine._config.translations.request_failed_body);
            UI.load(false)
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler.UpdatesProcessor = {
    process: function (A) {
        if (A.updates && !isObjectEmpty(A.updates)) {
            UpdatesObserver.receive_observer_updates(JSON.decode(A.updates))
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler.BeforeProcessor = {
    process: function (B) {
        var C = B.get_request_object();
        if (C.has_module()) {
            var A = C.get_module();
            Request.AJAX.before(A, B.get_request_data())
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler.XMPProcessor = {
    process: function (A) {
        if (!this._is_response_empty(A.xmps)) {
            this._process(A.xmps)
        }
    }, _appendNodes: function (C, E) {
        var A = document.createElement("div");
        A.innerHTML = E;
        var B = document.createDocumentFragment();
        var D = A.childNodes;
        if (D.length === 1) {
            B.appendChild(D[0])
        } else {
            while (A.childNodes.length > 0) {
                var F = A.firstChild;
                A.removeChild(F);
                B.appendChild(F)
            }
        }
        delete(D);
        $(C).appendChild(B)
    }, _process: function (b) {
        var C = undefined;
        for (var Z = 0; Z < b.length; Z++) {
            C = b[Z];
            if (C.nodeType == 1 && C.nodeName.toUpperCase() == "XMP") {
                var P = C.getAttribute("id");
                var a = C.getAttribute("append");
                var N = C.innerHTML;
                var d = null;
                if (P) {
                    d = document.getElementById(P)
                }
                if (d !== null) {
                    if (typeof ChatUIController !== "undefined") {
                        ChatUIController.html_parser.find_tags(N)
                    }
                    if (P === "canvas") {
                        d.innerHTML = N;
                        var A = d.firstChild,
                            F = undefined;
                        while (A) {
                            if (A.nodeType == 1) {
                                F = A.getAttribute("id");
                                break
                            }
                            A = A.nextSibling
                        }
                        if (typeof RequestEngine._current_page !== "undefined" && CanvasExitsTrigger[RequestEngine._current_page]) {
                            CanvasExitsTrigger[RequestEngine._current_page]()
                        }
                        if (typeof F !== "undefined" && CanvasTrigger[F]) {
                            CanvasTrigger[F]();
                            RequestEngine._current_page = F
                        }
                        Widget.Triggers.process_all();
                        window.scrollTo(window.pageXOffset, 0)
                    } else {
                        if (P !== "request_data") {
                            if (P === "light_box") {
                                LightBox.overlayLightbox.setContent(N);
                                var M = LightBox.overlayLightbox.getContent();
                                var E = M.id;
                                if (LightBoxTrigger[E]) {
                                    LightBoxTrigger[E]("light_box")
                                }
                            } else {
                                if (a) {
                                    var G = N
                                } else {
                                    var G = N.replace(/^[^<]*<(?:div|tr|h\d)[^>]*>/i, "").replace(/<\/(?:div|tr|h\d)>[ \t\r\n]*$/i, "");
                                    var K = N.match(/^[^<]*<(?:div|tr|h\d)[^>]+class\s*=\s*"([^"]+)"[^>]*>/i);
                                    if (K) {
                                        var c = K[1].split(/\s+/);
                                        d = $(d);
                                        for (var Y = 0; Y < c.length; Y++) {
                                            d.addClass(c[Y])
                                        }
                                    }
                                }
                                if (Browser.ie) {
                                    if ($(d).getTag() === "tr") {
                                        var S = $(d).getChildren();
                                        for (var Y = 0; Y < S.length; Y++) {
                                            $(S[Y]).remove()
                                        }
                                        var I = G.replace(/<td/ig, "<tmp");
                                        I = I.replace(/<\/td>/ig, "</tmp>");
                                        var V = I.split("<tmp");
                                        var U = document.createElement("div");
                                        var D;
                                        var H;
                                        var B;
                                        var O;
                                        if (V.length > 0) {
                                            for (var X = 0; X < V.length; X++) {
                                                if (V[X].trim() != "") {
                                                    D = "<tmp" + V[X];
                                                    H = D.match(/<tmp([^>]*)>/i);
                                                    D = D.replace(/<tmp/ig, "<div");
                                                    D = D.replace(/<\/tmp>/ig, "</div>");
                                                    U.innerHTML = D;
                                                    var L = document.createElement("td");
                                                    if (H.length > 0) {
                                                        for (var W = 0; W < H.length; W++) {
                                                            B = H[W].match(/\w+="[^"]+"/g);
                                                            if (B.length >= 1) {
                                                                for (var T = 0; T < B.length; T++) {
                                                                    O = B[T].match(/(\w+)="([^"]+)"/);
                                                                    if (O[1] === "colspan") {
                                                                        O[1] = "colSpan"
                                                                    }
                                                                    if (Browser.ie8) {
                                                                        O[2] = O[2].replace(/&quot;/g, '"')
                                                                    }
                                                                    $(L).attr(O[1], O[2])
                                                                }
                                                            }
                                                        }
                                                    }
                                                    var R = $(U).getChildren();
                                                    for (var Q = 0; Q < R.length; Q++) {
                                                        $(L).innerHTML += R[Q].innerHTML
                                                    }
                                                    d.appendChild(L)
                                                }
                                            }
                                        }
                                    } else {
                                        if (a) {
                                            this._appendNodes(d, G)
                                        } else {
                                            d.innerHTML = G
                                        }
                                    }
                                } else {
                                    if (a) {
                                        this._appendNodes(d, G)
                                    } else {
                                        d.innerHTML = G
                                    }
                                }
                                this._process_triggers(P)
                            }
                        }
                    }
                } else {
                    if (P === "_redirect") {
                        Request.standard_handler.click(C.innerHTML, [], [])
                    }
                    var J = JSON.decode(C.getAttribute(RequestEngine._config.additional_parameters_element_id));
                    if ((P === "request_data") && (J)) {
                        if (typeof AdditionalParams !== "undefined") {
                            AdditionalParams.set(J)
                        }
                    }
                }
            }
        }
        this._process_chat_triggers();
        if (typeof BlastVideoHandler !== "undefined" && BlastVideoHandler.isBlastZone && BlastVideoHandler.isBlastZone() && BlastVideoHandler.isTimeElapsed && BlastVideoHandler.isTimeElapsed()) {
            AutorollVideoHandler.playBlast()
        }
        if (typeof AutorollVideoHandler !== "undefined" && AutorollVideoHandler.isReady && AutorollVideoHandler.isReady()) {
            AutorollVideoHandler.playAd()
        }
    }, _prepare_id_for_trigger: function (A) {
        return A.replace(/_\d+$/, "").replace(/^trigger-/, "")
    }, _process_triggers: function (B) {
        var A = this._prepare_id_for_trigger(B);
        if (BlocksTrigger[A]) {
            BlocksTrigger[A](B)
        } else {
            if (HomeTrigger[A]) {
                HomeTrigger[A](B)
            } else {
                if (AlbumsTrigger[A]) {
                    AlbumsTrigger[A](B)
                } else {
                    if (PeopleTrigger[A]) {
                        PeopleTrigger[A](B)
                    } else {
                        if (SettingsTrigger[A]) {
                            SettingsTrigger[A](B)
                        } else {
                            if (VideosTrigger[A]) {
                                VideosTrigger[A](B)
                            } else {
                                if (AdminBarTrigger[A]) {
                                    AdminBarTrigger[A](B)
                                } else {
                                    if (AlbumsshowcaseTrigger[A]) {
                                        AlbumsshowcaseTrigger[A](B)
                                    } else {
                                        if (StatusTrigger[A]) {
                                            StatusTrigger[A](B)
                                        } else {
                                            if (WidgetsTrigger[A]) {
                                                WidgetsTrigger[A](B)
                                            } else {
                                                if (ContentSuggestionsTrigger[A]) {
                                                    ContentSuggestionsTrigger[A](B)
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }, _process_chat_triggers: function () {
        if (typeof ChatUIController !== "undefined") {
            ChatUIController.on_page_request_performed()
        }
    }, _is_response_empty: function (A) {
        return typeof A !== "undefined" && A.constructor == Array && A.length === 0
    }
};
RequestEngine.AJAX.Web2ResponseHandler.ChatTagsProcessor = {
    process: function (A) {
        if (typeof ChatUIController !== "undefined") {
            ChatUIController.html_parser.replace_tags()
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler.ImageExtenderProcessor = {
    process: function (A) {
        if (typeof ExtendedImage !== "undefined") {
            ExtendedImage.extend_all_images_in_dom()
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler.UILoaderProcessor = {
    process: function (A) {
        UI.load(false)
    }
};
RequestEngine.AJAX.Web2ResponseHandler.AfterProcessor = {
    process: function (B) {
        var C = B.get_request_object();
        if (C.has_module()) {
            var A = C.get_module();
            if (typeof A.after !== "undefined") {
                A.after(B.get_request_data())
            }
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler.TitleProcessor = {
    process: function (A) {
        if (A.title) {
            if (A.title !== null && A.title !== undefined) {
                parent.document.title = A.title
            }
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler.SpecialAjaxResponsesProcessor = {
    process: function (C) {
        switch (C.return_code) {
        case RequestEngine._config.tuenti_state_logout:
            var E = RequestEngine._config.login_redirect_cookie_name;
            var A = RequestEngine._config.cookie_domain;
            var B = RequestEngine._config.manual_logout_cookie_name;
            var J = RequestEngine._config.login_url;
            var I = true;
            if (Cookie.read(B) == 1) {
                I = false
            }
            document.cookie = E + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=" + A + ";";
            document.cookie = B + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=" + A + ";";
            if (I) {
                var G = new Date();
                G.setTime(G.getTime() + 1800000);
                document.cookie = E + "=" + escape(window.top.location.href) + "; expires=" + G.toGMTString() + "; path=/; domain=" + A + ";"
            }
            window.top.location.href = J;
            break;
        case RequestEngine._config.tuenti_state_maintenance:
            var F = {
                "close_button": RequestEngine._config.translations.close_button,
                "title": RequestEngine._config.translations.request_failed_title,
                "message": RequestEngine._config.translations.request_failed_body,
                "retry_countdown_text": RequestEngine._config.translations.retry_countdown_text
            };
            LightboxHelper.createLightboxFromSimpleTemplate("js_template_failed_request", F, {});
            UI.load(false);
            $("retrying_countdown_timeout").innerHTML = RequestEngine._config.retry_timeout_value;
            $("retrying_countdown").show();
            var M = RequestEngine._config.retry_timeout_value;
            var D = setInterval(function () {
                M--;
                if (M <= 0) {
                    window.location.reload()
                }
                $("retrying_countdown_timeout").innerHTML = M
            }, 1000);
            var H = $id(LightBox._TEMPLATE_CONSTANTS.close_button_id);
            if (H) {
                var L = H.onclick;
                H.onclick = function () {
                    clearInterval(D);
                    L();
                    return false
                }
            }
            LightBox.resize();
            break;
        case RequestEngine._config.tuenti_state_feature_disabled:
            var N = RequestEngine._config.translations.request_feature_disabled_body;
            FeedbackController.createErrorConfirmFeedback(N);
            break;
        default:
            break
        }
        var K = C.get_request_object();
        if (K.has_module() && K.get_module().feedback_submit_button) {
            K.get_module().feedback_submit_button.fail()
        }
    }
};
RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.SpecialAjaxResponsesProcessor);
RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.BeforeProcessor);
RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.XMPProcessor);
RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.ChatTagsProcessor);
RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.ImageExtenderProcessor);
RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.UILoaderProcessor);
RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.AfterProcessor);
RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.TitleProcessor);
load.traceExperimental(new TraceInformation({
    filename: "js/web2-Zero/1_request_engine.js",
    preRender: {
        listener: function () {
            RequestEngine.init();
            if (typeof UpdatesObserver !== "undefined") {
                RequestEngine.AJAX.Web2ResponseHandler.add_processor(RequestEngine.AJAX.Web2ResponseHandler.UpdatesProcessor)
            }
        }
    }
}));
var Request = {
    is_valid: function () {
        var B = false;
        if (typeof SID_COOKIE === "undefined") {
            B = true
        } else {
            var C = $("logged_viewer_sid") !== false ? $("logged_viewer_sid").value : undefined;
            var A = Cookie.read(SID_COOKIE);
            if (A === undefined || A === null) {
                B = true
            } else {
                if (typeof C !== "undefined" && A !== null) {
                    B = (C == A)
                }
            }
        }
        if (typeof RequestEngine !== "undefined" && typeof RequestEngine._config === "undefined") {
            RequestEngine.init()
        }
        return B
    }, _on_invalid_request: function () {
        document.location.reload()
    }
};
Request.AJAX = {
    iframe_unique_counter: 0,
    iframe_pool: [],
    _callback: undefined,
    prechecks: function (A) {
        if (!Request.is_valid()) {
            Request._on_invalid_request()
        }
        var B = true;
        if (A && A.cleaner) {
            A.cleaner.cleanup.call(A.cleaner)
        }
        if (A && A.validator) {
            B = A.validator.validate.call(A.validator)
        }
        return B
    }, send: function (B, D, A, C, F) {
        var E = false;
        F = typeof F === "undefined" ? false : F;
        C = typeof C === "undefined" ? false : C;
        if (Request.AJAX.prechecks(D)) {
            if (C) {
                RequestEngine.IFRAME.send(B, D, A)
            } else {
                RequestEngine.AJAX.send(B, D, A)
            }
            E = true
        }
        if (D !== undefined && D !== null && D.feedback_submit_button) {
            if (E) {
                D.feedback_submit_button.send()
            }
        }
        if (this._is_anyone_subscribed() && !F) {
            this._callback.apply()
        }
        return E
    }, before: function (B, A) {
        if (B !== undefined && B !== null) {
            if (B.feedback_submit_button) {
                B.feedback_submit_button.before(A)
            }
            if (B.before) {
                B.before(A)
            }
        }
    }, submit_form: function (B, D, E, A, C, G) {
        var F = false;
        G = typeof G === "undefined" ? false : G;
        C = typeof C === "undefined" ? false : C;
        if (Request.AJAX.prechecks(D)) {
            if (C) {
                RequestEngine.IFRAME.submit_form(B, D, E, A)
            } else {
                RequestEngine.AJAX.submit_form(B, D, E, A)
            }
            F = true
        }
        if (D !== undefined && D !== null && D.feedback_submit_button) {
            if (F) {
                D.feedback_submit_button.send()
            }
        }
        if (this._is_anyone_subscribed() && !G) {
            this._callback.apply()
        }
        return F
    }, _is_anyone_subscribed: function () {
        return typeof this._callback !== "undefined"
    }, subscribe_to_change: function (A) {
        this._callback = A
    }, unsuscribe_from_changes: function () {
        this._callback = undefined
    }
};
Request.standard_handler = {
    click: function (B, A, D) {
        var C = {
            url: undefined,
            post_params: undefined,
            additional_params: undefined,
            click: function (F, E, G) {
                this.url = F;
                this.post_params = E;
                this.additional_params = G;
                this.send()
            }, send: function () {
                Request.AJAX.send(this.url, this)
            }, before: function () {}, after: function () {}
        };
        C.click(B, A, D)
    }
};
Request.custom_handler = {
    click: function (B, A, D) {
        var C = {
            url: undefined,
            post_params: undefined,
            additional_params: undefined,
            feedback_submit_button: undefined,
            click: function (F, E, G) {
                this.url = F;
                this.post_params = E;
                this.additional_params = G;
                if ((typeof G !== "undefined") && (typeof G.confirm !== "undefined")) {
                    FeedbackController.createConfirmFeedback(G.confirm.message, DialogFeedback.types.ALERT, function (H) {
                        return function () {
                            H.send()
                        }
                    }(this))
                } else {
                    this.send()
                }
            }, send: function () {
                if (typeof this.additional_params.button !== "undefined") {
                    this.feedback_submit_button = FormFeedback.submit_button(this.additional_params.button, this.additional_params.process_message, this.additional_params.success_message, this.additional_params.failure_message)
                }
                Request.AJAX.send(this.url, this)
            }, before: function (F) {
                if (typeof this.additional_params.feedback !== "undefined" && this.additional_params.feedback) {
                    try {
                        var G = JSON.decode(F.innerHTML);
                        if (typeof G === "object") {
                            if (G.success) {
                                FeedbackController.createSuccessFeedback(G.message)
                            } else {
                                FeedbackController.createFailFeedback(G.message)
                            }
                        }
                    } catch (H) {
                        FeedbackController.createFeedbackFromRequestData(F)
                    }
                }
                if ((typeof this.additional_params.onSuccess !== "undefined") && F.getAttribute("success")) {
                    var I = this.additional_params.onSuccess.method.toObject();
                    I.apply(this, this.additional_params.onSuccess.params)
                } else {
                    if ((typeof this.additional_params.onError !== "undefined") && !F.getAttribute("success")) {
                        var E = this.additional_params.onError.method.toObject();
                        E.apply(this, this.additional_params.onError.params)
                    }
                }
            }, after: function () {}
        };
        C.click(B, A, D)
    }
};
load.trace("js/web2-Zero/1_request.js");
var StateManager = {
    hash: "",
    _current_url_hash: undefined,
    _poll_interval: undefined,
    _state_iframe_id: "statemanager",
    _state_iframe_url: (window.STATIC_PATHS[Math.floor(Math.random() * window.STATIC_PATHS.length)] || window.STATIC_PATH) + "request_engine/1_statemanager.html",
    _iframe_hash: undefined,
    getIframeHash: function () {
        return this._iframe_hash
    }, setIframeHash: function (A) {
        this._iframe_hash = A
    }, _browser_hash: undefined,
    getBrowserHash: function () {
        return this._browser_hash
    }, setBrowserHash: function (A) {
        this._browser_hash = A
    }, slots: {
        _slots: {}, _last_used_slot: 0,
        _is_valid_slot: function (A) {
            return typeof StateManager.slots._slots[A] != "undefined" && StateManager.slots._slots[A].constructor == Array
        }, add_to_slot: function (B, A) {
            if (!StateManager.slots._is_valid_slot(B)) {
                StateManager.slots._slots[B] = []
            }
            StateManager.slots._slots[B].push(A)
        }, is_url_in_slot: function (D, A) {
            var C = false;
            if (StateManager.slots._is_valid_slot(D)) {
                var B = 0;
                while (!C && typeof StateManager.slots._slots[D][B] !== "undefined") {
                    C = StateManager.equalHashes(StateManager.slots._slots[D][B] || "", A);
                    B++
                }
            }
            return C
        }, add_url: function (A) {
            var D = false;
            var C = undefined;
            var B = 0;
            while (!D) {
                if (B != StateManager.slots._last_used_slot) {
                    if (typeof StateManager.slots._slots[B] === "undefined" || !StateManager.slots.is_url_in_slot(B, A)) {
                        D = true;
                        C = B
                    }
                }
                B++
            }
            StateManager.slots.add_to_slot(C, A);
            StateManager.slots._last_used_slot = C;
            return C
        }
    }, is_state_iframe_loaded: function () {
        var B = document.getElementById(StateManager._state_iframe_id);
        var A = false;
        if (B) {
            try {
                A = B.readyState == "complete"
            } catch (C) {
                A = false
            }
            delete B
        }
        return A
    }, check: function () {
        if (Browser.ie) {
            if (StateManager.is_state_iframe_loaded()) {
                var A = document.getElementById(StateManager._state_iframe_id);
                var B = A.contentWindow.location.hash;
                var C = window.location.hash;
                if (!StateManager.equalHashes(B, StateManager.getIframeHash())) {
                    StateManager.setIframeHash(B);
                    StateManager.setBrowserHash(B);
                    window.location.hash = B;
                    StateManager.slots._last_used_slot = A.contentWindow.location["search"].substring(1);
                    StateManager.onHashChanged()
                } else {
                    if (!StateManager.equalHashes(C, StateManager.getBrowserHash())) {
                        StateManager.setBrowserHash(C);
                        StateManager.onHashChanged()
                    }
                }
                delete A
            }
        } else {
            var C = window.location.hash;
            if (Browser.firefox) {
                C = encodeURI(C)
            }
            if (!StateManager.equalHashes(C, StateManager.getBrowserHash())) {
                StateManager.setBrowserHash(C);
                StateManager.onHashChanged()
            }
        }
    }, stop: function () {
        window.clearInterval(this._poll_interval)
    }, get_current_url_hash: function () {
        if (typeof StateManager._current_url_hash === "undefined") {
            StateManager.init()
        }
        return StateManager._current_url_hash
    }, _sanitize_hash: function (B) {
        var A;
        if (typeof B === "string") {
            A = B.replace(/^[#]+/, "#")
        } else {
            A = "#"
        }
        return A
    }, hashCheckTimer: function () {
        return window.setInterval(StateManager.check, 50)
    }, init: function () {
        var A = undefined;
        if (typeof window.location.hash === "undefined" || window.location.hash === "") {
            var B = document.cookie.match("tempHash=([^;]+)(;|$)");
            if (B) {
                A = "#" + B[1]
            }
        } else {
            A = "#" + window.location.hash
        }
        if (typeof StateManager._poll_interval != undefined) {
            window.clearInterval(StateManager._poll_interval)
        }
        if (Browser.ie) {
            var C = document.createElement("iframe");
            C.src = StateManager._state_iframe_url + "?0" + StateManager._sanitize_hash(A);
            C.id = StateManager._state_iframe_id;
            C.className = "hide";
            document.body.appendChild(C);
            StateManager.setIframeHash(A);
            delete C
        }
        StateManager.setBrowserHash(A);
        window.location.hash = StateManager._sanitize_hash(A);
        StateManager._poll_interval = StateManager.hashCheckTimer()
    }, equalHashes: function (C, B) {
        var A = true;
        if (typeof C === "string" && typeof B === "string") {
            if (Browser.firefox) {
                C = C.replace(/ /g, "%20");
                B = B.replace(/ /g, "%20")
            }
            A = C.replace(/&anchor=[^&#\?]+/i, "") === B.replace(/&anchor=[^&#\?]+/i, "")
        }
        return A
    }, onHashChanged: function () {
        Request.AJAX.send("?" + window.location.hash.split("#")[1] + "&ajax_target=canvas&ajax=1")
    }, cleanUrl4theIframe: function (C) {
        var A = "";
        var D = C.split("&");
        C = "";
        if (D !== undefined) {
            for (var B in D) {
                if (!D.hasOwnProperty(B)) {
                    continue
                }
                var E = D.split("=");
                if (E[0] !== "ajax_target" && E[0] !== "ajax" && E[0] !== "csfr" && E[0] !== "store") {
                    if (C === "") {
                        A = ""
                    } else {
                        A = "&"
                    }
                    C += A + E[0] + "=" + E[1]
                }
            }
        }
        return C
    }, store_in_history_if_needed: function (C) {
        var B = URLInterpreter.interpret(C);
        var A = B.should_store_in_history();
        if (A) {
            StateManager.store_hash_in_history(B)
        }
        return A
    }, store_in_history: function (B) {
        var A = URLInterpreter.interpret(B);
        StateManager.store_hash_in_history(A)
    }, store_hash_in_history: function (A) {
        var C = URLInterpreter.interpret(StateManager.getBrowserHash()).integrate_with_hash(A).string();
        if (Browser.ie) {
            var B = document.getElementById(StateManager._state_iframe_id);
            var D = StateManager.slots.add_url(C);
            B.contentWindow.location.assign(StateManager._state_iframe_url + "?" + D + C);
            this.setIframeHash(C);
            delete B
        }
        StateManager.setBrowserHash(C);
        window.location.hash = C
    }, set_hash_with_no_request: function (A) {
        StateManager._current_url_hash = URLInterpreter.interpret("#");
        StateManager.store_in_history(A)
    }, go_to_hash: function (A) {
        StateManager._current_url_hash = URLInterpreter.interpret("#");
        Request.AJAX.send("?" + A.split("#")[1] + "&ajax_target=canvas&ajax=1");
        StateManager.store_in_history(A)
    }
};
var URLInterpreter = {
    interpret: function (B) {
        var A = {
            parameters_list: undefined,
            parameters_dictionary: undefined,
            init: function (E) {
                this.parameters_list = [];
                this.parameters_dictionary = [];
                var G = E.replace(/^(\?|#)/g, "").split("&");
                var D;
                for (D = 0; D < G.length; D++) {
                    var F = G[D].split("=");
                    var C = F[0];
                    this.parameters_list.push(C);
                    this.parameters_dictionary[C] = F[1]
                }
            }, equals_hash_string: function (F) {
                var E = true;
                var D;
                var G = F.match(/[?#&]([^=]+)=([^&]+)/g);
                if (G && G.length <= this.parameters_list.length) {
                    for (D = 0; E && D < G.length; D++) {
                        var H = /[?#&]([^=]+)=([\w%_-]+)(?:&|$)/g.exec(G[D]);
                        var C = H[1];
                        if (!C.match(/^ajax|^store$|^func$/i) || this.parameters_dictionary[C].toLowerCase() != "index") {
                            E = (this.parameters_dictionary[C] === H[2])
                        }
                    }
                } else {
                    E = false
                }
                return E
            }, should_store_in_history: function () {
                return parseInt(this.parameters_dictionary["store"]) === 1
            }, integrate_with_hash: function (F) {
                var C;
                if (this.parameters_dictionary["m"] === F.parameters_dictionary["m"] && F.parameters_dictionary["ajax_target"] !== "canvas") {
                    var E;
                    for (E = 0; E < F.parameters_list.length; E++) {
                        var D = F.parameters_list[E];
                        if (D != "m" && D != "func") {
                            if (typeof this.parameters_dictionary[D] === "undefined") {
                                this.parameters_list.push(D)
                            }
                            this.parameters_dictionary[D] = F.parameters_dictionary[D]
                        }
                    }
                    C = this
                } else {
                    C = F
                }
                return C
            }, string: function () {
                var C = "#";
                var E;
                var D;
                if (0 < this.parameters_list.length) {
                    D = this.parameters_list[0];
                    C += D + "=" + this.parameters_dictionary[D]
                }
                for (E = 1; E < this.parameters_list.length; E++) {
                    D = this.parameters_list[E];
                    if (!D.match(/^ajax|^store$/i)) {
                        C += "&" + D + "=" + this.parameters_dictionary[D]
                    }
                }
                return C
            }
        };
        A.init(B);
        return A
    }
};
load.trace("js/web2-Zero/1_statemanager.js", 2, StateManager.init);
var previous_document_images = [];
var ExtendedImage = {
    config: undefined,
    init: function (A) {
        this.config = A
    }, extend_all_images_in_dom: function () {
        var D = (new Date()).getTime();
        var A = document.getElementsByTagName("img");
        var C;
        for (C = 0; C < A.length; C++) {
            var B = A[C];
            if (!B.extended && B.id !== "loading") {
                B.extended = true;
                if (ExtendedImage.config.FAILED_TIMEOUT !== null) {
                    new ImageLoadTracker(B, D)
                }
            }
        }
    }
};

function ImageLoadTracker(B, C) {
    this.image = B;
    this.starting_time = C;
    this.timeout = setTimeout(function () {
        A._did_fail()
    }, ExtendedImage.config.FAILED_TIMEOUT);
    var A = this;
    $(B).addEvent("load", function () {
        A._did_load()
    })
}
ImageLoadTracker.prototype = {
    image: undefined,
    starting_time: undefined,
    timeout: undefined,
    _did_load: function () {
        clearTimeout(this.timeout);
        if (typeof this.image.firstTime === "undefined") {
            if (this._sampling_check(ExtendedImage.config.SAMPLING_SUCCESS_RATE)) {
                this._send_feedback(true, this.image.src, this._get_ellapsed_time(this.starting_time))
            }
            this.image.firstTime = false
        }
    }, _did_fail: function () {
        if (this._sampling_check(ExtendedImage.config.SAMPLING_FAIL_RATE)) {
            this._send_feedback(false, this.image.src, this._get_ellapsed_time(this.starting_time))
        }
    }, _get_ellapsed_time: function (A) {
        return (new Date()).getTime() - A
    }, _sampling_check: function (A) {
        return Math.random() * ExtendedImage.config.SAMPLING_BASE < A
    }, _send_feedback: function (C, D, B) {
        var A = {
            url: ExtendedImage.config.TRACKING_URL,
            post_params: undefined,
            perform: function (F, G, E) {
                this.post_params = {};
                this.post_params[ExtendedImage.config.SUCCESS_PARAM] = F;
                this.post_params[ExtendedImage.config.ELAPSED_TIME_PARAM] = E;
                this.post_params[ExtendedImage.config.HASH_PARAM] = document.location.hash;
                this.post_params[ExtendedImage.config.IMAGE_URL_PARAM] = G;
                this.post_params[ExtendedImage.config.SUCCESS_PARAM] = F;
                this.post_params[ExtendedImage.config.CSFR_PARAM] = ExtendedImage.config.CSFR;
                this.send()
            }, send: function () {
                Request.AJAX.send(this.url, this, false, false, true)
            }
        };
        A.perform.call(A, C, D, B)
    }
};
load.traceExperimental(new TraceInformation({
    filename: "js/web2-Zero/1_images.js",
    postRender: {
        listener: function () {
            if (typeof IMAGE_TRACKING_ENABLED !== "undefined" && IMAGE_TRACKING_ENABLED === true) {
                ExtendedImage.init(SiteConfig.extendedImageConfig);
                ExtendedImage.extend_all_images_in_dom()
            }
        }
    }
}));
var PersistentStateController = {
    data: undefined,
    store: undefined,
    modules: [],
    init: function () {
        this.modules.push(VideoPlayer.persistent_state);
        this.modules.push(ChatUIController.persistent_state);
        this.store = new CookieStorage("PersistentState")
    }, _restore_from_cookie: function () {
        var A = this.store.get();
        this.store.clear();
        if (typeof A === "undefined" || A === null || typeof A.owner !== "string" || A.owner !== VIEWER_ID) {
            A = {}
        }
        return A
    }, restore: function () {
        var C = this._restore_from_cookie();
        for (var B = 0; B < this.modules.length; B++) {
            var A = this.modules[B];
            if (typeof A === "object" && A !== null && typeof A.configuration === "object" && A.configuration !== null && typeof A.configuration.name === "string" && A.configuration.name.length > 0 && typeof A.load === "function") {
                A.load.call(A, C[A.configuration.name])
            }
        }
    }, save: function () {
        var C = {};
        C["owner"] = VIEWER_ID;
        for (var B = 0; B < this.modules.length; B++) {
            var A = this.modules[B];
            if (typeof A === "object" && A !== null && typeof A.configuration === "object" && A.configuration !== null && typeof A.configuration.name === "string" && A.configuration.name.length > 0 && typeof A.save === "function") {
                C[A.configuration.name] = A.save.apply(A)
            }
        }
        this.store.set(C);
        this.store.commit()
    }
};
load.traceExperimental(new TraceInformation({
    filename: "js/web2-Zero/1_persistent_state.js",
    postRender: {
        listener: function () {
            PersistentStateController.init();
            PersistentStateController.restore()
        }
    }
}));
var CookieStorage = function (C, F) {
    var B = 3 * 1024;
    var A = "CookieStorage";
    var D = 0;
    if (typeof C === "string") {
        this.name = C
    } else {
        this.name = A + "_" + (parseInt(Math.random() * 100000))
    }
    if (typeof F === "number") {
        this.days = F
    } else {
        this.days = D
    }
    var E = function (J) {
        var H = [];
        var I = new RegExp("(" + J + "[^= ;]+)=", "ig");
        var K = document.cookie;
        var G = I.exec(K);
        while (G !== null) {
            H.push(G[1]);
            G = I.exec(K)
        }
        return H
    };
    this.cookie_value = undefined;
    this.set = function (G) {
        this.cookie_value = G
    };
    this.get = function () {
        var G = E(this.name).length;
        var K = undefined;
        try {
            var H = [];
            for (var J = 0; J < G; J++) {
                H[J] = Cookie.read(this.name + "_" + J)
            }
            K = JSON.decode(decodeURIComponent(H.join()))
        } catch (I) {}
        return K
    };
    this.clear = function () {
        Cookie.erase_all_with_prefix(this.name)
    };
    this.commit = function () {
        this.clear();
        var I = JSON.encode(this.cookie_value) || "";
        var K = I.slice(0);
        I = encodeURIComponent(I);
        var J = [];
        do {
            var G = I.slice(0, B);
            J.push(G);
            I = I.slice(B)
        } while (I.length > 0);
        for (var H = 0; H < J.length; H++) {
            Cookie.create(this.name + "_" + H, J[H], this.days)
        }
        return K
    };
    return this.name
};
load.trace("js/web2-Zero/1_cookie_storage.js");

function Animation(A) {
    if (this == window) {
        return new Animation(A)
    } else {
        this.obj = A;
        this._reset_state();
        this.queue = [];
        this.last_attr = null
    }
}
Animation.resolution = 20;
Animation.offset = 0;
Animation.prototype._reset_state = function () {
    this.state = {
        attrs: {}, duration: 500
    }
};
Animation.prototype.stop = function () {
    this._reset_state();
    this.queue = [];
    return this
};
Animation.prototype._build_container = function () {
    if (this.container_div) {
        this._refresh_container();
        return
    }
    if (this.obj.firstChild && this.obj.firstChild.__animation_refs) {
        this.container_div = this.obj.firstChild;
        this.container_div.__animation_refs++;
        this._refresh_container();
        return
    }
    var A = document.createElement("div");
    A.style.padding = "0px";
    A.style.margin = "0px";
    A.style.border = "0px";
    A.__animation_refs = 1;
    var B = this.obj.childNodes;
    while (B.length) {
        A.appendChild(B[0])
    }
    this.obj.appendChild(A);
    this.obj.style.overflow = "hidden";
    this.container_div = A;
    this._refresh_container()
};
Animation.prototype._refresh_container = function () {
    this.container_div.style.height = "auto";
    this.container_div.style.width = "auto";
    this.container_div.style.height = this.container_div.offsetHeight + "px";
    this.container_div.style.width = this.container_div.offsetWidth + "px"
};
Animation.prototype._destroy_container = function () {
    if (!this.container_div) {
        return
    }
    if (!--this.container_div.__animation_refs) {
        var A = this.container_div.childNodes;
        while (A.length) {
            this.obj.appendChild(A[0])
        }
        this.obj.removeChild(this.container_div)
    }
    this.container_div = null
};
Animation.ATTR_TO = 1;
Animation.ATTR_BY = 2;
Animation.ATTR_FROM = 3;
Animation.prototype._attr = function (A, B, C) {
    A = A.replace(/-[a-z]/gi, function (E) {
        return E.substring(1).toUpperCase()
    });
    var D = false;
    switch (A) {
    case "background":
        this._attr("backgroundColor", B, C);
        return this;
    case "margin":
        B = Animation.parse_group(B);
        this._attr("marginBottom", B[0], C);
        this._attr("marginLeft", B[1], C);
        this._attr("marginRight", B[2], C);
        this._attr("marginTop", B[3], C);
        return this;
    case "padding":
        B = Animation.parse_group(B);
        this._attr("paddingBottom", B[0], C);
        this._attr("paddingLeft", B[1], C);
        this._attr("paddingRight", B[2], C);
        this._attr("paddingTop", B[3], C);
        return this;
    case "backgroundColor":
    case "borderColor":
    case "color":
        B = Animation.parse_color(B);
        break;
    case "opacity":
        B = parseFloat(B, 10);
        break;
    case "height":
    case "width":
        if (B == "auto") {
            D = true
        } else {
            B = parseInt(B, 10)
        }
        break;
    case "borderWidth":
    case "lineHeight":
    case "fontSize":
    case "marginBottom":
    case "marginLeft":
    case "marginRight":
    case "marginTop":
    case "paddingBottom":
    case "paddingLeft":
    case "paddingRight":
    case "paddingTop":
    case "bottom":
    case "left":
    case "right":
    case "top":
    case "scrollTop":
    case "scrollLeft":
        B = parseInt(B, 10);
        break;
    default:
        throw new Error(A + " is not a supported attribute!")
    }
    if (this.state.attrs[A] === undefined) {
        this.state.attrs[A] = {}
    }
    if (D) {
        this.state.attrs[A].auto = true
    }
    switch (C) {
    case Animation.ATTR_FROM:
        this.state.attrs[A].start = B;
        break;
    case Animation.ATTR_BY:
        this.state.attrs[A].by = true;
    case Animation.ATTR_TO:
        this.state.attrs[A].value = B;
        break
    }
};
Animation.prototype.to = function (A, B) {
    if (B === undefined) {
        this._attr(this.last_attr, A, Animation.ATTR_TO)
    } else {
        this._attr(A, B, Animation.ATTR_TO);
        this.last_attr = A
    }
    return this
};
Animation.prototype.by = function (A, B) {
    if (B === undefined) {
        this._attr(this.last_attr, A, Animation.ATTR_BY)
    } else {
        this._attr(A, B, Animation.ATTR_BY);
        this.last_attr = A
    }
    return this
};
Animation.prototype.from = function (A, B) {
    if (B === undefined) {
        this._attr(this.last_attr, A, Animation.ATTR_FROM)
    } else {
        this._attr(A, B, Animation.ATTR_FROM);
        this.last_attr = A
    }
    return this
};
Animation.prototype.duration = function (A) {
    this.state.duration = A ? A : 0;
    return this
};
Animation.prototype.checkpoint = function (B, A) {
    if (B === undefined) {
        B = 1
    }
    this.state.checkpoint = B;
    this.state.checkpointcb = A;
    this.queue.push(this.state);
    this._reset_state();
    return this
};
Animation.prototype.blind = function () {
    this.state.blind = true;
    return this
};
Animation.prototype.hide = function () {
    this.state.hide = true;
    return this
};
Animation.prototype.show = function () {
    this.state.show = true;
    return this
};
Animation.prototype.ease = function (A) {
    this.state.ease = A;
    return this
};
Animation.prototype.go = function () {
    var B = (new Date()).getTime();
    this.queue.push(this.state);
    for (var A = 0; A < this.queue.length; A++) {
        this.queue[A].start = B - Animation.offset;
        if (this.queue[A].checkpoint) {
            B += this.queue[A].checkpoint * this.queue[A].duration
        }
    }
    Animation.push(this);
    return this
};
Animation.prototype._frame = function (D) {
    var E = true;
    var F = false;
    var K = false;
    for (var G = 0; G < this.queue.length; G++) {
        var O = this.queue[G];
        if (O.start > D) {
            E = false;
            continue
        } else {
            if (O.checkpointcb && (O.checkpoint * O.duration + O.start > D)) {
                this._callback(O.checkpointcb, D - O.start - O.checkpoint * O.duration);
                O.checkpointcb = null
            }
        }
        if (O.started === undefined) {
            if (O.show) {
                this.obj.style.display = "block"
            }
            for (var M in O.attrs) {
                if (O.attrs[M].start !== undefined) {
                    continue
                }
                switch (M) {
                case "backgroundColor":
                case "borderColor":
                case "color":
                    var C = Animation.parse_color(Animation.get_style(this.obj, M == "borderColor" ? "borderLeftColor" : M));
                    if (O.attrs[M].by) {
                        O.attrs[M].value[0] = Math.min(255, Math.max(0, O.attrs[M].value[0] + C[0]));
                        O.attrs[M].value[1] = Math.min(255, Math.max(0, O.attrs[M].value[1] + C[1]));
                        O.attrs[M].value[2] = Math.min(255, Math.max(0, O.attrs[M].value[2] + C[2]))
                    }
                    break;
                case "opacity":
                    var C = ((C = Animation.get_style(this.obj, "opacity")) && parseFloat(C)) || ((C = Animation.get_style(this.obj, "opacity")) && (C = /(\d+(?:\.\d+)?)/.exec(C)) && parseFloat(C.pop()) / 100) || 1;
                    if (O.attrs[M].by) {
                        O.attrs[M].value = Math.min(1, Math.max(0, O.attrs[M].value + C))
                    }
                    break;
                case "height":
                case "width":
                    var C = Animation["get_" + M](this.obj);
                    if (O.attrs[M].by) {
                        O.attrs[M].value += C
                    }
                    break;
                case "scrollLeft":
                case "scrollTop":
                    var C = (this.obj == document.body) ? (document.documentElement[M] || document.body[M]) : this.obj[M];
                    if (O.attrs[M].by) {
                        O.attrs[M].value += C
                    }
                    O["last" + M] = C;
                    break;
                default:
                    var C = parseInt(Animation.get_style(this.obj, M), 10);
                    if (O.attrs[M].by) {
                        O.attrs[M].value += C
                    }
                    break
                }
                O.attrs[M].start = C
            }
            if ((O.attrs.height && O.attrs.height.auto) || (O.attrs.width && O.attrs.width.auto)) {
                if (/Firefox\/[12]\./.test(navigator.userAgent)) {
                    K = true
                }
                this._destroy_container();
                for (var M in {
                    height: 1,
                    width: 1,
                    fontSize: 1,
                    borderLeftWidth: 1,
                    borderRightWidth: 1,
                    borderTopWidth: 1,
                    borderBottomWidth: 1,
                    paddingLeft: 1,
                    paddingRight: 1,
                    paddingTop: 1,
                    paddingBottom: 1
                }) {
                    if (O.attrs[M]) {
                        this.obj.style[M] = O.attrs[M].value + (typeof O.attrs[M].value == "number" ? "px" : "")
                    }
                }
                if (O.attrs.height && O.attrs.height.auto) {
                    O.attrs.height.value = Animation.get_height(this.obj)
                }
                if (O.attrs.width && O.attrs.width.auto) {
                    O.attrs.width.value = Animation.get_width(this.obj)
                }
            }
            O.started = true;
            if (O.blind) {
                this._build_container()
            }
        }
        var B = (D - O.start) / O.duration;
        if (B >= 1) {
            B = 1;
            if (O.hide) {
                this.obj.style.display = "none"
            }
        } else {
            E = false
        }
        var L = O.ease ? O.ease(B) : B;
        if (!F && B != 1 && O.blind) {
            F = true
        }
        if (K && this.obj.parentNode) {
            var H = this.obj.parentNode;
            var A = this.obj.nextSibling;
            H.removeChild(this.obj)
        }
        for (var M in O.attrs) {
            switch (M) {
            case "backgroundColor":
            case "borderColor":
            case "color":
                this.obj.style[M] = "rgb(" + Animation.calc_tween(L, O.attrs[M].start[0], O.attrs[M].value[0], true) + "," + Animation.calc_tween(L, O.attrs[M].start[1], O.attrs[M].value[1], true) + "," + Animation.calc_tween(L, O.attrs[M].start[2], O.attrs[M].value[2], true) + ")";
                break;
            case "opacity":
                var I = Animation.calc_tween(L, O.attrs[M].start, O.attrs[M].value);
                try {
                    this.obj.style.opacity = (I == 1 ? "" : I);
                    this.obj.style.filter = (I == 1 ? "" : "alpha(opacity=" + I * 100 + ")")
                } catch (J) {}
                break;
            case "height":
            case "width":
                this.obj.style[M] = L == 1 && O.attrs[M].auto ? "auto" : Animation.calc_tween(L, O.attrs[M].start, O.attrs[M].value, true) + "px";
                break;
            case "scrollLeft":
            case "scrollTop":
                var C = (this.obj == document.body) ? (document.documentElement[M] || document.body[M]) : this.obj[M];
                if (O["last" + M] != C) {
                    delete O.attrs[M]
                } else {
                    var N = Animation.calc_tween(L, O.attrs[M].start, O.attrs[M].value, true) - C;
                    if (M == "scrollLeft") {
                        window.scrollBy(N, 0)
                    } else {
                        window.scrollBy(0, N)
                    }
                    O["last" + M] = N + C
                }
                break;
            default:
                this.obj.style[M] = Animation.calc_tween(L, O.attrs[M].start, O.attrs[M].value, true) + "px";
                break
            }
        }
        if (B == 1) {
            this.queue.splice(G--, 1);
            this._callback(O.ondone, D - O.start - O.duration)
        }
    }
    if (K) {
        H[A ? "insertBefore" : "appendChild"](this.obj, A)
    }
    if (!F && this.container_div) {
        this._destroy_container()
    }
    return !E
};
Animation.prototype.ondone = function (A) {
    this.state.ondone = A;
    return this
};
Animation.prototype.onstart = function (A) {
    this.state.onstart = A;
    return this
};
Animation.prototype.onframerendered = function (A) {
    this.state.onframerendered = A;
    return this
};
Animation.prototype._callback = function (B, A) {
    if (B) {
        Animation.offset = A;
        B.call(this);
        Animation.offset = 0
    }
};
Animation.calc_tween = function (B, D, C, A) {
    return (A ? parseInt : parseFloat)((C - D) * B + D, 10)
};
Animation.parse_color = function (A) {
    var C = /^#([a-f0-9]{1,2})([a-f0-9]{1,2})([a-f0-9]{1,2})$/i.exec(A);
    if (C) {
        return [parseInt(C[1].length == 1 ? C[1] + C[1] : C[1], 16), parseInt(C[2].length == 1 ? C[2] + C[2] : C[2], 16), parseInt(C[3].length == 1 ? C[3] + C[3] : C[3], 16)]
    } else {
        var B = /^rgba? *\(([0-9]+), *([0-9]+), *([0-9]+)(?:, *([0-9]+))?\)$/.exec(A);
        if (B) {
            if (B[4] === "0") {
                return [255, 255, 255]
            } else {
                return [parseInt(B[1], 10), parseInt(B[2], 10), parseInt(B[3], 10)]
            }
        } else {
            if (A == "transparent") {
                return [255, 255, 255]
            } else {
                throw "Named color attributes are not supported."
            }
        }
    }
};
Animation.parse_group = function (A) {
    var A = trim(A).split(/ +/);
    if (A.length == 4) {
        return A
    } else {
        if (A.length == 3) {
            return [A[0], A[1], A[2], A[1]]
        } else {
            if (A.length == 2) {
                return [A[0], A[1], A[0], A[1]]
            } else {
                return [A[0], A[0], A[0], A[0]]
            }
        }
    }
};
Animation.get_height = function (D) {
    var C = parseInt(Animation.get_style(D, "paddingTop"), 10),
        B = parseInt(Animation.get_style(D, "paddingBottom"), 10),
        A = parseInt(Animation.get_style(D, "borderTopWidth"), 10),
        E = parseInt(Animation.get_style(D, "borderBottomWidth"), 10);
    return D.offsetHeight - (C ? C : 0) - (B ? B : 0) - (A ? A : 0) - (E ? E : 0)
};
Animation.get_width = function (C) {
    var B = parseInt(Animation.get_style(C, "paddingLeft"), 10),
        E = parseInt(Animation.get_style(C, "paddingRight"), 10),
        D = parseInt(Animation.get_style(C, "borderLeftWidth"), 10),
        A = parseInt(Animation.get_style(C, "borderRightWidth"), 10);
    return C.offsetWidth - (B ? B : 0) - (E ? E : 0) - (D ? D : 0) - (A ? A : 0)
};
Animation.get_style = function (B, C) {
    var A;
    return (window.getComputedStyle && window.getComputedStyle(B, null).getPropertyValue(C.replace(/[A-Z]/g, function (D) {
        return "-" + D.toLowerCase()
    }))) || (document.defaultView && document.defaultView.getComputedStyle && (A = document.defaultView.getComputedStyle(B, null)) && A.getPropertyValue(C.replace(/[A-Z]/g, function (D) {
        return "-" + D.toLowerCase()
    }))) || (B.currentStyle && B.currentStyle[C]) || B.style[C]
};
Animation.push = function (A) {
    if (!Animation.active) {
        Animation.active = []
    }
    Animation.active.push(A);
    if (!Animation.timeout) {
        Animation.timeout = setInterval(Animation.animate, Animation.resolution)
    }
};
Animation.animate = function () {
    var B = true;
    var D = (new Date()).getTime();
    for (var C = 0; C < Animation.active.length; C++) {
        var A = Animation.active[C];
        if (A._frame(D)) {
            if (A.state.onstart) {
                A.state.onstart.call();
                delete A.state.onstart
            }
            if (A.state.onframerendered) {
                A.state.onframerendered.call()
            }
            B = false
        } else {
            Animation.active.splice(C--, 1)
        }
    }
    if (B) {
        clearInterval(Animation.timeout);
        Animation.timeout = null
    }
};
Animation.ease = {};
Animation.ease.begin = function (A) {
    return A * A
};
Animation.ease.end = function (A) {
    A -= 1;
    return -(A * A) + 1
};
Animation.ease.both = function (A) {
    if (A <= 0.5) {
        return (A * A) * 2
    } else {
        A -= 1;
        return (A * A) * -2 + 1
    }
};
load.trace("js/web2-Zero/1_animation.js");
var RichMedia = {
    VIDEO_PROVIDER_YOUTUBE: "yt",
    HTTP_PREFIX: "http://",
    URL_CLASS: {
        NORMAL: undefined,
        MALICIOUS: undefined,
        TRUSTED: undefined
    }, translations: {}, url_display_length: undefined,
    init: function () {
        var A = $id("rich_media_config");
        var B = {};
        if (A && A.getAttribute("config")) {
            B = JSON.decode($id("rich_media_config").getAttribute("config"))
        }
        this.translations = B.translations || "";
        this.url_classification = B.url_classification || {
            classes: {}
        };
        this.url_display_length = B.url_display_length;
        this.URL_CLASS.NORMAL = this.url_classification.classes.normal || "";
        this.URL_CLASS.MALICIOUS = this.url_classification.classes.malicious || "";
        this.URL_CLASS.TRUSTED = this.url_classification.classes.trusted || ""
    }, _httpize: function (A) {
        if (A.indexOf("http://") === -1 && A.indexOf("https://") === -1) {
            A = this.HTTP_PREFIX + A
        }
        return A
    }, _fix_url_length: function (A) {
        if (this.url_display_length && A.length > this.url_display_length) {
            return A.substr(0, this.url_display_length - 1)
        } else {
            return A
        }
    }, _clean_url: function (A) {
        return A.replace(/<|>|'/g, "")
    }, openExternalLink: function (C, A, D, B) {
        if (typeof D === "undefined") {
            D = this.URL_CLASS.NORMAL
        }
        if (B === true) {
            this._getUrlClassification(this.url_classification, C, A);
            return false
        }
        ActionTracker.log(Action.type.CLICK_URL, {
            url: C
        }, true);
        switch (D) {
        case this.URL_CLASS.MALICIOUS:
            this._showMaliciousLinkWarning(this.translations.malicious_external_url_title, this.translations.malicious_external_url_message, DialogFeedback.types.ALERT);
            break;
        case this.URL_CLASS.TRUSTED:
            this._showLinkWithMessage(this._fix_url_length(C), "js_template_external_link_with_url_content", DialogFeedback.types.INFO, this.translations.trusted_external_url_title, this.translations.trusted_external_url_message, this.translations.trusted_external_url_question, [this._getOkButton(C), this._getCancelButton(true)]);
            break;
        case this.URL_CLASS.NORMAL:
            this._showLinkWithMessage(this._fix_url_length(C), "js_template_external_link_with_url_content", DialogFeedback.types.ALERT, this.translations.normal_external_url_title, this.translations.normal_external_url_message, this.translations.normal_external_url_question, [this._getCancelButton(), this._getOkButton(C, true)]);
            break;
        default:
            throw "Unknown url type"
        }
    }, openVideoInProvider: function (E, C) {
        var D;
        var B;
        var A;
        switch (E) {
        case RichMedia.VIDEO_PROVIDER_YOUTUBE:
        default:
            D = this.translations.youtube_video_url_title;
            B = this.translations.youtube_video_url_message;
            A = this.translations.youtube_video_url_question
        }
        this._showLinkWithMessage(this._httpize(C), "js_template_external_link_without_url_content", DialogFeedback.types.INFO, D, B, A, [this._getOkButton(C), this._getCancelButton(true)])
    }, showReasonDialog: function () {
        this._showMaliciousLinkWarning(this.translations.malicious_external_url_removed_reason, this.translations.malicious_external_url_message, DialogFeedback.types.INFO)
    }, _showLinkWithMessage: function (A, H, G, F, I, C, E) {
        var B = {
            message: I,
            question: C,
            url: A.htmlEncode()
        };
        var D = JSTemplates.load_template_element(H, B);
        FeedbackController.createDialogFeedback({
            type: G,
            close: true,
            title: F,
            content: D,
            buttons: E
        })
    }, _showMaliciousLinkWarning: function (E, D, B) {
        var A = {
            message: D
        };
        var C = JSTemplates.load_template_element("js_template_malicious_external_link_warning", A);
        FeedbackController.createDialogFeedback({
            type: B,
            close: {
                enabled: true
            }, title: E,
            content: C,
            buttons: [{
                label: this.translations.confirm,
                method: function () {
                    return false
                }
            }]
        })
    }, _getOkButton: function (B, A) {
        if (typeof A === "undefined") {
            A = false
        }
        return {
            label: this.translations.ok,
            renderAsLink: A,
            key: 13,
            method: function () {
                B = RichMedia._clean_url(B);
                window.open(B);
                ActionTracker.log(Action.type.GO_TO_URL, {
                    url: B
                }, true);
                return false
            }
        }
    }, _getCancelButton: function (A) {
        if (typeof A === "undefined") {
            A = false
        }
        return {
            label: this.translations.cancel,
            renderAsLink: A,
            defaultCloseAction: true,
            key: 27,
            method: function () {
                return false
            }
        }
    }, _getUrlClassification: function (B, A, C) {
        var D = {
            force_not_cancel: true,
            url: undefined,
            get_params: {}, url_to_classify: undefined,
            send: function (F, E) {
                this.url = F.url;
                this.url_to_classify = E;
                this.get_params[F.param_name] = this.url_to_classify;
                Request.AJAX.send(this.url, this)
            }, before: function (E) {
                if (E.getAttribute("success")) {
                    RichMedia.openExternalLink(this.url_to_classify, C, parseInt(E.innerHTML, 10))
                } else {
                    RichMedia.openExternalLink(this.url_to_classify, C)
                }
            }, after: function (E) {}
        };
        D.send(B, A)
    }
};
load.trace("js/web2-Zero/1_rich_media.js", SELECTOR_PRIORITY_TRIGGERS, function () {
    RichMedia.init()
});
var XMLHttpObjectHandler = {};
XMLHttpObjectHandler.XHRFactory = {
    get_xhr_object: function () {
        return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest()
    }
};
XMLHttpObjectHandler.RequestFactory = {
    _default_timeout_value: 10,
    send_request: function (B) {
        if (B.is_request_empty()) {
            XMLHttpObjectHandler.RequestManager.perform(new Web2RequestConfiguration({
                "type": XMLHttpObjectHandler.RequestManager.GET,
                "url": B.url,
                "request_object": B,
                "request_headers": {
                    "Content-Type": "application/x-www-form-urlencoded"
                }, "on_success": B.on_success,
                "on_internal_server_error": B.on_internal_server_error,
                "on_forbidden": B.on_forbidden,
                "timeout": XMLHttpObjectHandler.RequestFactory._default_timeout_value,
                "on_timeout": B.on_timeout
            }))
        } else {
            XMLHttpObjectHandler.RequestManager.perform(new Web2RequestConfiguration({
                "type": XMLHttpObjectHandler.RequestManager.POST,
                "url": B.url,
                "request_object": B,
                "request_headers": {
                    "Content-Type": "application/x-www-form-urlencoded"
                }, "on_success": B.on_success,
                "on_internal_server_error": B.on_internal_server_error,
                "on_forbidden": B.on_forbidden,
                "timeout": XMLHttpObjectHandler.RequestFactory._default_timeout_value,
                "on_timeout": B.on_timeout
            }))
        }
    }
};
XMLHttpObjectHandler.RequestManager = {
    GET: "GET",
    POST: "POST",
    defaultTimeout: 10,
    _last_request: undefined,
    accepts: {
        xml: "application/xml, text/xml",
        html: "text/html",
        script: "text/javascript, application/javascript",
        json: "application/json, text/javascript",
        text: "text/plain",
        _default: "*/*"
    }, perform: function (G) {
        if (this._should_cancel_previous_request()) {
            this.cancel_previous_request()
        }
        var F = XMLHttpObjectHandler.XHRFactory.get_xhr_object();
        F.open(G.type, G.url, G.async);
        var E = this;
        if (G.has_any_request_header()) {
            for (var H in G.request_headers) {
                if (!G.request_headers.hasOwnProperty(H)) {
                    continue
                }
                F.setRequestHeader(H, G.request_headers[H])
            }
        }
        F.onreadystatechange = function () {
            if (XMLHttpObjectHandler.ResponseStateManager.is_loading(F.readyState)) {
                if (G.request_object.farm !== window.top.ClientRouter.get_failover_farm()) {
                    G.timeoutID = setTimeout(function () {
                        G.clientAborted = true;
                        F.abort();
                        E._on_timeout_request(F, G)
                    }, (G.timeout || E.defaultTimeout) * 1000)
                }
            } else {
                if (XMLHttpObjectHandler.ResponseStateManager.is_complete(F.readyState)) {
                    if (G.clientAborted !== true) {
                        clearInterval(G.timeoutID);
                        E._on_completed_request(F, G)
                    }
                }
            }
        };
        this._last_request = {
            "xhr": F,
            "request_config": G
        };
        if (G.type == this.GET) {
            F.send(null)
        } else {
            if (G.type == this.POST) {
                F.send(this._build_param_string_from_post_params(G.request_object.module.post_params))
            }
        }
    }, _on_completed_request: function (D, C) {
        XMLHttpObjectHandler.RequestManager._last_request = undefined;
        if (XMLHttpObjectHandler.ResponseStateManager.is_success(D.status)) {
            this._on_success(D, C)
        } else {
            if (XMLHttpObjectHandler.ResponseStateManager.is_internal_server_error(D.status)) {
                this._on_internal_server_error(D, C)
            } else {
                if (XMLHttpObjectHandler.ResponseStateManager.is_forbidden(D.status)) {
                    this._on_forbidden(D, C)
                }
            }
        }
    }, _on_timeout_request: function (D, C) {
        XMLHttpObjectHandler.RequestManager._last_request = undefined;
        if (typeof C.on_timeout !== "undefined") {
            C.on_timeout.method.call(C.on_timeout.scope, C)
        }
    }, _on_success: function (E, F) {
        if (typeof F.on_success !== "undefined") {
            var D;
            if (typeof window.top.RequestEngine !== "undefined" && typeof window.top.RequestEngine._config !== "undefined" && typeof window.top.RequestEngine._config.http_header_state !== "undefined" && E.getResponseHeader(window.top.RequestEngine._config.http_header_state) != undefined && E.getResponseHeader(window.top.RequestEngine._config.http_header_state) !== "") {
                D = XMLHttpObjectHandler.ResponseHelper._build_response_object_from_server_special_page(F.request_object, E.getResponseHeader(window.top.RequestEngine._config.http_header_state));
                F.on_success.method.call(F.on_success.scope, D)
            } else {
                D = XMLHttpObjectHandler.ResponseHelper._build_response_object_from_server_response(E.responseText, F.request_object);
                F.on_success.method.call(F.on_success.scope, D)
            }
        }
    }, _on_internal_server_error: function (E, F) {
        if (typeof F.on_internal_server_error !== "undefined") {
            var D = XMLHttpObjectHandler.ResponseHelper._build_error_response(F.request_object, XMLHttpObjectHandler.ResponseStateManager.response_status.INTERNAL_SERVER_ERROR);
            F.on_internal_server_error.method.call(F.on_internal_server_error.scope, D)
        }
    }, _on_forbidden: function (E, F) {
        if (typeof F.on_forbidden !== "undefined") {
            var D = XMLHttpObjectHandler.ResponseHelper._build_error_response(F.request_object, XMLHttpObjectHandler.ResponseStateManager.response_status.FORBIDDEN);
            F.on_forbidden.method.call(F.on_internal_server_error.scope, D)
        }
    }, _build_param_string_from_post_params: function (H) {
        var E = [];
        for (var F in H) {
            if (!H.hasOwnProperty(F)) {
                continue
            }
            if (typeof H[F].is_array !== "undefined" || (F.indexOf("[") !== -1 && F.indexOf("]") !== -1)) {
                if (typeof H[F]["array_values"] !== "undefined") {
                    for (var G = 0; G < H[F]["array_values"].length; G++) {
                        E.push(F + "[]=" + encodeURIComponent(H[F]["array_values"][G]))
                    }
                } else {
                    for (var G = 0; G < H[F].length; G++) {
                        E.push(F + "=" + encodeURIComponent(H[F][G]))
                    }
                }
            } else {
                E.push(F + "=" + encodeURIComponent(H[F]))
            }
        }
        return E.join("&")
    }, _should_cancel_previous_request: function () {
        var B = false;
        if (typeof this._last_request !== "undefined") {
            B = this._last_request.request_config.type == this.GET && this._last_request.request_config.request_object.force_not_cancel === false
        }
        return B
    }, cancel_previous_request: function () {
        if (typeof this._last_request.xhr !== "undefined") {
            this._last_request.xhr.abort();
            this._last_request = undefined
        }
    }
};
XMLHttpObjectHandler.ResponseStateManager = {
    request_states: {
        UNINITIALIZED: 0,
        LOADING: 1,
        LOADED: 2,
        INTERACTIVE: 3,
        COMPLETE: 4
    }, response_status: {
        OK: "200",
        INTERNAL_SERVER_ERROR: "500",
        FORBIDDEN: "403",
        NOT_FOUND: "404",
        FOUND: "302",
        NOT_MODIFIED: "304"
    }, is_complete: function (B) {
        return B == this.request_states.COMPLETE
    }, is_loading: function (B) {
        return B == this.request_states.LOADING
    }, is_success: function (B) {
        return (B == this.response_status.OK || B == this.response_status.NOT_MODIFIED || B == this.response_status.FOUND || B == window.top.RequestEngine._config.tuenti_state_logout || B == window.top.RequestEngine._config.tuenti_state_maintenance || B == window.top.RequestEngine._config.tuenti_state_feature_disabled)
    }, is_forbidden: function (B) {
        return B == this.response_status.FORBIDDEN
    }, is_not_found: function (B) {
        return B == this.response_status.NOT_FOUND
    }, is_internal_server_error: function (B) {
        return B == this.response_status.INTERNAL_SERVER_ERROR
    }
};
XMLHttpObjectHandler.ResponseHelper = {
    _request_data_id: "request_data",
    _container_id_prefix: "web2_response_container_",
    _custom_random: function (H, E) {
        var F = E - H;
        var G = Math.floor(Math.random() * F);
        return parseInt(H) + G
    }, _build_response_object_from_server_response: function (O, T) {
        var R = document.createElement("div");
        R.innerHTML = O;
        R.id = this._container_id_prefix + new Date().getTime() + this._custom_random(0, 100);
        document.body.appendChild(R);
        var L = document.getElementById(this._request_data_id);
        var P = L.getAttribute("success");
        var Q = L.getAttribute("updates");
        var S = L.getAttribute("title");
        if (P === "") {
            P = true
        }
        var K = R.getElementsByTagName("xmp");
        var M = [];
        for (var N = 0; N < K.length; N++) {
            M.push(K[N].cloneNode(true))
        }
        document.body.removeChild(document.getElementById(R.id));
        return new Web2ResponseObject({
            "request_object": T,
            "request_data": L,
            "success": P,
            "return_code": XMLHttpObjectHandler.ResponseStateManager.response_status.OK,
            "updates": Q,
            "title": S,
            "xmps": M
        })
    }, _build_response_object_from_server_special_page: function (D, C) {
        return new Web2ResponseObject({
            "request_object": D,
            "request_data": undefined,
            "success": true,
            "return_code": C,
            "updates": undefined,
            "title": undefined,
            "xmps": []
        })
    }, _build_error_response: function (D, C) {
        return new Web2ResponseObject({
            "request_object": D,
            "request_data": undefined,
            "success": false,
            "return_code": C,
            "updates": undefined,
            "title": undefined,
            "xmps": undefined
        })
    }
};

function Web2RequestConfiguration(B) {
    this.type = B.type;
    this.url = B.url;
    this.async = B.async || true;
    this.cache = B.cache || false;
    this.request_headers = B.request_headers || {};
    this.request_object = B.request_object || {};
    this.on_success = B.on_success || undefined;
    this.on_internal_server_error = B.on_internal_server_error || undefined;
    this.on_forbidden = B.on_forbidden || undefined;
    this.timeout = B.timeout || undefined;
    this.on_timeout = B.on_timeout || undefined;
    this.has_any_request_header = function () {
        return !isObjectEmpty(this.request_headers)
    }
}
function Web2RequestObject(B) {
    this.url = B.url;
    this.module = B.module || {};
    this.force_not_cancel = typeof B.force_not_cancel !== "undefined" ? B.force_not_cancel : false;
    this.farm = B.farm || undefined;
    this.original_url = B.original_url || undefined;
    this.is_request_empty = function () {
        return isObjectEmpty(this.module) || typeof this.module.post_params === "undefined" || isObjectEmpty(this.module.post_params)
    };
    this.has_module = function () {
        return !isObjectEmpty(this.module)
    };
    this.get_module = function () {
        return this.module
    }
}
function Web2ResponseObject(B) {
    this.xmps = B.xmps;
    this.request_data = B.request_data,
    this.updates = B.updates || {};
    this.return_code = B.return_code;
    if (B.success == 1) {
        B.success = true
    } else {
        if (B.success == 0) {
            B.success = false
        } else {
            if (B.success == null || B.success == undefined) {
                B.success = true
            }
        }
    }
    this.success = B.success;
    this.message = B.message || "";
    this.title = B.title || "";
    this.request_object = B.request_object;
    this.get_request_object = function () {
        return this.request_object
    };
    this.get_request_data = function () {
        return this.request_data
    }
}
function isObjectEmpty(C) {
    for (var D in C) {
        return false
    }
    return true
}
if (typeof load !== "undefined") {
    load.trace("request_engine/1_request_engine_schemas.js")
}
load.trace("js_core_1_zero.js")